Giter Club home page Giter Club logo

Comments (14)

songololo avatar songololo commented on May 28, 2024

+1

from rtree.

marfago avatar marfago commented on May 28, 2024

Actually seems it is not possible. At least with recent versions.

libspatialindex/libspatialindex#71

from rtree.

hobu avatar hobu commented on May 28, 2024

libspatialindex is not threadsafe and Rtree does not do thread safety. It is something that could be done, but it would take a lot of meticulous work to achieve.

from rtree.

christophlingg avatar christophlingg commented on May 28, 2024

Ok I can comprehend that concurrent writing and reading may cause problems, but are read-only accesses safe?

from rtree.

marfago avatar marfago commented on May 28, 2024

In my experience it seems it is not.
In a project I use https://github.com/collective/collective.geo.index, wich is based on RTree. For each search it instantiates a new instance of RTree and now and then it crashes with segmentation fault. I solved this issue moving the rtree to a global variable (just one instance). Not sure it can help.

from rtree.

christophlingg avatar christophlingg commented on May 28, 2024

That's strange because I am accessing one rtree from multiple threads (only read), and so far i did not encounter any problems.

from rtree.

snorfalorpagus avatar snorfalorpagus commented on May 28, 2024

@christophlingg Race conditions can be like that. It may be that certain issues are only triggered under high(er) loads.

from rtree.

hobu avatar hobu commented on May 28, 2024

Ok I can comprehend that concurrent writing and reading may cause problems, but are read-only accesses safe?

No. libspatialindex, especially as used through the C API like Rtree does, is not thread safe. If it is working for you, it is most likely due to luck.

from rtree.

christophlingg avatar christophlingg commented on May 28, 2024

Now I know I need to fix something ;-) Thanks to your feedback I can do this before it crashes!

from rtree.

hobu avatar hobu commented on May 28, 2024

The most pressing issue is probably the one described in libspatialindex/libspatialindex#71 especially in regards to the C API.

If you put some aggressive locking around things in python land, you are likely to be reasonably protected. The issues most likely manifest themselves in regard to error messages, and the error stack of the C API of libspatialindex not being protected in any way.

from rtree.

marfago avatar marfago commented on May 28, 2024

I'm working with a single thread instance of the index, but it daily crashes!
Can anyone suggest what exactly should be "protected" in python?

from rtree.

hobu avatar hobu commented on May 28, 2024

Can anyone suggest what exactly should be "protected" in python?

Protect any access you do to libspatialindex with a mutex and lock accordingly.

from rtree.

marfago avatar marfago commented on May 28, 2024

@hobu :Adding mutex or lock did not work for me. Moreover, also using different processes working on the same index file ends up in segmentation fault.

from rtree.

hobu avatar hobu commented on May 28, 2024

libspatialindex has a thread safety issue. Someone needs to develop a clear case that demonstrates the issue so it can be resolved.

from rtree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.