Azure / AzureStor

R interface to Azure storage accounts
Other
64 stars 20 forks source link

Connection error with readr 2.0.0 #95

Closed nik-humphries closed 3 years ago

nik-humphries commented 3 years ago

A close connection error is achieved when using readr 2.0.0. Code works fine on readr 1.4.0. Readr makes the connection invalid after reading from it.

Tested using

AzureStor::storage_read_csv(container = my_container,
                                           file = fileName,
                                           ...)

which returns the error

Error in close.connection(con) : invalid connection

You can test connections not being closed properly by running the following

con <- rawConnection(raw(0), "r+")
writeBin("hiya", con)
readr::read_csv(con)
con

close(con)
Error in close.connection(con) : invalid connection

Looking at con gives A connection, specifically, ‘rawConnection’, but invalid.

Unsure if this is an issue for the readr package, or if something that can be handled within here.

hongooi73 commented 3 years ago

Looks like read_delim behaviour changed between readr 1.4.0 and 2.0.0 so that it now automatically closes connections.

I'll fix AzureStor to handle this, but you might want to raise this issue at the readr repo as well.

hongooi73 commented 3 years ago

You may also be able to work around this problem by setting the readr edition to 1, see ?readr::with_edition

nik-humphries commented 3 years ago

I raised an issue here, it seems as though this is intended behaviour for readr 2.0.0.

https://github.com/tidyverse/readr/issues/1261

vidarsumo commented 3 years ago

Had the same issue, setting the edition to 1 solved it.

hongooi73 commented 3 years ago

This should now be fixed in the dev version. Let me know if the problem persists.

nik-humphries commented 3 years ago

Excellent - thanks.