rstudio / bundle

Prepare objects for serialization with a consistent interface
https://rstudio.github.io/bundle/
Other
27 stars 4 forks source link

bundle_h2o() forgets to remove temporary file #59

Closed HenrikBengtsson closed 11 months ago

HenrikBengtsson commented 11 months ago

The auxillary, temporary file file_loc in:

https://github.com/rstudio/bundle/blob/42549d6d9e390f582b675391bb8cc01ea3dbe280/R/bundle_h2o.R#L80-L87

is never deleted.

juliasilge commented 11 months ago

It turns out that several of our bundle methods save a temp file and then do not manually clean it up, but rather wait for it to be cleaned up when the R session ends. Can you say more about why waiting for the temp file to be cleaned up with the session is a problem? Did you notice a problem only with H2O and not other bundle methods like keras?

HenrikBengtsson commented 11 months ago

I just noticed it for this particular function, but I didn't check the others.

The main problem is that temp dir is a limited resource. You can easily fill it up if you do lots of these calls. This is even critical on multi-user systems.

juliasilge commented 11 months ago

Oh wait, I forgot that since we use functions from withr like local_tempdir() and the like, this is already taken care of! These functions do remove the temporary files and directories on exit.

HenrikBengtsson commented 11 months ago

Oh, yes. False alert.

(I've been so much HPC work recently where with distinguish between the local tempdir on local disk and global tempdir on global file system that I didn't pay much attention to local_tempdir(). Oh, well.)