geos icon indicating copy to clipboard operation
geos copied to clipboard

PreparedGeometry::contains is not thread safe

Open gauteh opened this issue 4 years ago • 11 comments
trafficstars

Hi,

It seems that prepared geometry contains is not thread safe before run at least once. Easiest to provoke on large geometries. Not able to provoke on example in docs.

Regards, Gaute

gauteh avatar Sep 08 '21 14:09 gauteh

Can you provide me a code having this issue so I can fix it and enforce it through tests please?

GuillaumeGomez avatar Sep 08 '21 14:09 GuillaumeGomez

https://github.com/gauteh/roaring-landmask/pull/6/files#diff-6423871468d8d2f4ebf2a85e879f9ba388c361b859c9191d62d4571685c95f58 , I think you need a big geometry for this to trigger.

gauteh avatar Sep 08 '21 18:09 gauteh

Ok, I'll try to take a look when I have a bit of time.

GuillaumeGomez avatar Sep 08 '21 18:09 GuillaumeGomez

:+1: thanks. I can work around this atm by using a warmup call. It is most likely an upstream bug. But would be a pity to !Send/!Sync Geometry/PreparedGeometry just because of that.

gauteh avatar Sep 08 '21 18:09 gauteh

Don't hesitate to take a look in the meantime. If yu can find a way to go around this limitation without removing Send and Sync, it'd be perfect. :)

GuillaumeGomez avatar Sep 08 '21 18:09 GuillaumeGomez

If we can afford a warmup call to contains, that is the only way I can think of at the moment (without fixing upstream). From the backtrace in geos it seems like the segfault happens somewhere in sorting of a vector in the geometry. I'll take a further look if(/when..?) I find the time!

On Wed, Sep 8, 2021 at 8:33 PM Guillaume Gomez @.***> wrote:

Don't hesitate to take a look in the meantime. If yu can find a way to go around this limitation without removing Send and Sync, it'd be perfect. :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/georust/geos/issues/95#issuecomment-915474738, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN364WETWQORRMMUE24X3UA6UALANCNFSM5DUZS3CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

gauteh avatar Sep 08 '21 18:09 gauteh

Thanks, greatly appreciated! A bit under the water currently. ^^'

GuillaumeGomez avatar Sep 08 '21 18:09 GuillaumeGomez

No problem, thanks for the effort!

gauteh avatar Sep 08 '21 18:09 gauteh

In version 9 with geos 3.11 it is no longer reliable to warm up the prepared geometry to make it thread safe.

gauteh avatar May 14 '24 13:05 gauteh