-
Notifications
You must be signed in to change notification settings - Fork 286
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
read_csv does not close unsuccessful connections #1050
Comments
I can reproduce with this minimal reprex con <- curl::curl('https://cloud.r-project.org/CRAN_mirrorsZ.csv')
open(con, 'rb')
rm(con)
gc()
con <- curl::curl('https://cloud.r-project.org/CRAN_mirrorsZ.csv')
readr:::read_connection(con)
rm(con)
gc() removing the connection object and garbage collecting will trigger the warnings. Lines 106 to 115 in 192cb1c
Even if the close(con) is inside the on.exit
If we close, no warnings # does no warn
con <- curl::curl('https://cloud.r-project.org/CRAN_mirrorsZ.csv')
readr:::read_connection(con)
close(con)
rm(con)
gc() I think the hope it helps. |
Thanks @cderv for looking into it. I had the same thoughts, namely that the erratic behaviour might be due to garbage collection and that the |
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
read_csv
and friends trigger aclosing unused connection
warning whenever an attempt to read over a connection is not successful.spelling error in url, so attempt is aborted.
The timing of the warning is a bit erratic, i.e. it sometimes shows up after executing one more command, sometimes it takes a few more commands. I've often had success with something like:
Session info
The text was updated successfully, but these errors were encountered: