Comments (14)
+1
from rtree.
Actually seems it is not possible. At least with recent versions.
libspatialindex/libspatialindex#71
from rtree.
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.
Ok I can comprehend that concurrent writing and reading may cause problems, but are read-only accesses safe?
from rtree.
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.
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.
@christophlingg Race conditions can be like that. It may be that certain issues are only triggered under high(er) loads.
from rtree.
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.
Now I know I need to fix something ;-) Thanks to your feedback I can do this before it crashes!
from rtree.
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.
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.
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.
@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.
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)
- Python 3.10 wheels HOT 2
- rtree fails to import HOT 1
- ArgumentError: expected LP_LP_c_long instance instead of pointer to LP_c_long HOT 8
- typing_extensions now required HOT 1
- Using rtree in Cygwin HOT 1
- import rtree leads to `OSError: Could not load libspatialindex_c library` on aarch64 HOT 6
- Please release a new version with the type hints support HOT 1
- Index is checking write access despite assuming read-only access HOT 3
- why .dat file modified after intersection query?
- Nearest Neighbour Metric
- how to output more information about the constructed Rtree HOT 1
- QUESTION: How can rtree.index.Index properties be used to tweak performance ? HOT 2
- Linux binary wheels have two copies of libspatialindex HOT 1
- Calculating the Height of an R-Tree: Where Did I Go Wrong? HOT 1
- Issue with Python 3.12.0rc1 HOT 5
- "Unable to open file '%s' for index storage" - Write permissions on index should not be required HOT 1
- About RTree Data Structure Persistent Storage HOT 3
- Release publishing automation HOT 1
- Allow string ids in indexes (or at least improve the error messages) HOT 2
- Determinism
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rtree.