-
Notifications
You must be signed in to change notification settings - Fork 3
Correctness issue, particularly for Julia 1.12 - use after free bug #39
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
base: master
Are you sure you want to change the base?
Conversation
| GeoInterface = "1" | ||
| LibSpatialIndex_jll = "1.9" | ||
| julia = "1.6" | ||
| Test = "1.6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Test = "1.6" | |
| Test = "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! And it looks like there are tests as well. If no one objects I'll merge this on Friday
|
LGTM, thanks for testing and making a PR. The rest of the ecosystem has moved away from using For completeness sake, note that an alternative method is to use https://docs.julialang.org/en/v1/base/base/#Base.GC.@preserve. |
Indeed, and this is extremely useful if you need to work around this issue if you can't immediately upgrade your version of libspatialindex, because you can use |
insert!,intersects, andknnall have code that looks something like this:The problem is that
pointeruses the vector it's passed implicitly, so does not prevent garbage collection of minvalues and maxvalues between when the pointer is created and when the C function is called. (see this and the last example in the first section here.This has probably been an issue for a long time, but it does seem at first unlikely that GC would happen to run in between allocation and use here - which is probably why it hasn't been noticed before. It seems changes in the garbage collection in Julia 1.12 make it much more likely that this will happen - I discovered it when this test started reliably failing on 1.12, specifically because this line started returning incorrect results because the correct values are not being inserted.
This builds on #36 and #38.