-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
segfault when reading from mmap derived from a file that get closed(?) #54128
Comments
I suspect Mmap is putting a finalizer on the wrong object (the Array) now that we have the Memory abstraction. The IOBuffer discards the unnecessary indirection, resulting in the Memory getting unmapped. Not using Mmap is also usually a good idea, as it doesn't suffer from this problem and generally performs better in well-written code (which is admittedly non-trivial to do). But we should fix Mmap to add the finalizer to the right object in v1.11 |
So is that just changing the finalizer from being on the returned array |
Yes |
Does this mean that the code prior to 1.11 could also segfault if the user |
Vague title because I am not really sure what is going on.
Slightly reduced from https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_hash/c356e60_vs_bd47eca/LasIO.primary.log
Pasting the following into the REPL segfaults:
Note that
pointdata
contains anIOBuffer
wrapping the inputpointbytes
(https://github.com/visr/LasIO.jl/blob/0a9f58d78c5a68da42b467275cdeca83cc0c7450/src/point.jl#L15-L20)Things that make it "work":
error()
call above thepointdata
printingclose(io)
outside thefinally
mmap
and instead usingpointbytes = read(io, n*pointsize)
Any idea @vtjnash?
The text was updated successfully, but these errors were encountered: