Skip to content
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

Can't delete files after read by vroom in R session #177

Closed
ericbrownaustin opened this issue Aug 15, 2019 · 8 comments
Closed

Can't delete files after read by vroom in R session #177

ericbrownaustin opened this issue Aug 15, 2019 · 8 comments
Labels
reprex needs a minimal reproducible example

Comments

@ericbrownaustin
Copy link

ericbrownaustin commented Aug 15, 2019

I read some files using vroom in R and after reading them, I received a windows File in Use error. Is this the expected behavior and if so, how can remove the files without dropping the R session?

image

@jimhester jimhester added the reprex needs a minimal reproducible example label Aug 15, 2019
@jimhester
Copy link
Collaborator

The error you are showing is a TAR file, which vroom does not read, please provide full details of what you are actually doing.

@ericbrownaustin
Copy link
Author

Same results for a tsv file which was read without issue.

image

@jimhester
Copy link
Collaborator

vroom reads files lazily, the file is initially memory mapped and remains open until all the values in the file have been read in it.

If you don't want the lazy reading you can use vroom(altrep_opts = FALSE) to read the file eagerly.

@oloverm
Copy link

oloverm commented Sep 18, 2019

I've got this issue too. If you want the general behaviour of vroom but just want to delete one file, is there a way to manually close it?

@rplati
Copy link

rplati commented Dec 2, 2019

Same issue here. vroom(altrep_opts = FALSE) does not seem to help. The only way to delete the file I’ve found is to close the R-session then delete it manually.

Would like to use vroom in a plumber API to read a csv file that arrives in multipart/form (parsed using Rook). Not being able to delete temporary files means the disk will fill up unless the service is reset periodically. Will need to use readr for now.

Minimal example:

tmpFile<-file.path(tempdir(), "iris.csv")
vroom_write(iris, tmpFile, delim = ",", quote="all")
irisVrm <- vroom(tmpFile, altrep_opts = FALSE)
rm(irisVrm)  # even deleting the object doesnt help
file.remove(tmpFile)

@jimhester
Copy link
Collaborator

I can reproduce this, it was due to a very stupid bug in the code I used to check if a file ends with a newline. It is now fixed.

@christian-beckmann
Copy link

Sadly this bug appears now in version 1.4.0. Can you bisect it?

@jimhester
Copy link
Collaborator

@christian-beckmann if you think there is an issue you will need to open a new issue with a reproducible example that demonstrates it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reprex needs a minimal reproducible example
Projects
None yet
Development

No branches or pull requests

5 participants