Skip to content

Need to close connection when done uploading via httr::VERB() #761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
juliasilge opened this issue Apr 26, 2025 · 0 comments
Open

Need to close connection when done uploading via httr::VERB() #761

juliasilge opened this issue Apr 26, 2025 · 0 comments

Comments

@juliasilge
Copy link
Member

Maybe related to #333?

If you use httr::VERB(), there are some lingering open connections after uploading a file:

citation <- httr::upload_file(system.file("CITATION"))
httr::VERB(
  "POST",
  url =  "http://httpbin.org/post",
  body = citation
)
#> Response [http://httpbin.org/post]
#>   Date: 2025-04-26 01:24
#>   Status: 200
#>   Content-Type: application/json
#>   Size: 1.19 kB
#> {
#>   "args": {}, 
#>   "data": "bibentry(\"Manual\",\n         title = \"R: A Language and Environ...
#>   "files": {}, 
#>   "form": {}, 
#>   "headers": {
#>     "Accept": "application/json, text/xml, application/xml, */*", 
#>     "Accept-Encoding": "deflate, gzip", 
#>     "Content-Length": "643", 
#>     "Content-Type": "text/plain", 
#> ...
showConnections()
#>   description                                                                         
#> 3 ""                                                                                  
#> 4 "/Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library/base/CITATION"
#>   class  mode  text     isopen   can read can write
#> 3 "file" "w+b" "binary" "opened" "yes"    "yes"    
#> 4 "file" "rb"  "binary" "opened" "yes"    "no"

Created on 2025-04-25 with reprex v2.1.1

This is showing up in pins on Connect pretty dramatically (you'll see a half dozen "closing unused connection" if you write and then read a pin to Connect), as well as (I believe) other pins backends like GCS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant