You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tell ya what...I'll at least make sure that streams opened by IO#copy_stream get closed when it's done. They would close due to finalization, so this wasn't really a leak...but it was bad form.
FYI: This also solves another issue I stumbled upon using JRuby 1.7.19, which was that the RubyIO instances could be GC'd during #copy_stream, since they weren't referenced after getting their channels, which caused their finalizers to run and close them. This error appeared as
Errno::EBADF: Bad file descriptor - Bad file descriptor
copy_stream at org/jruby/RubyIO.java:4694
It seems to me that JRuby deviates from MRI implementation of
IO.copy_stream
:To demonstrate run the following snippet in MRI and jruby:
In MRI
IO.copy_stream "README.md", "/tmp/readme"
doesn't leave opened files in the ObjectSpace.But in jruby,
ObjectSpace.each_object(File).reject(&:closed?)
would include 2 extra implicitly created file descriptors fromIO.copy_stream
.It is an expected behaviour?
Relevant refile/refile issue: refile/refile#414
The text was updated successfully, but these errors were encountered: