-
Notifications
You must be signed in to change notification settings - Fork 28
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
SIGSEGV in _BTree_get() #21
Comments
We use BTrees+gevent+ClientStorage in some configurations, and I haven't seen any crashes like this. |
Any ideas how to deeper dig into this? It's fairly reproducible. As soon as there is some more activity going on with the db (like every program startup cycle), I see the usual startup, then the activity peak, I see a bunch of new threads spawned, and then the segfault:
These new threads also get spawned, when I run the database in-process, so not sure, what they're doing, but I guess they don't seem to cause the issue. What I also noted, especially on startup I get KeyErrors from BTrees on keys, that are supposed to be present, and also show up as being present just on retrying. Ever noticed something like that? |
@ml31415 if you can build Python with debug enabled, and run your app under Another question: are you trying to share your database connection across threads? The ZODB doesn't expect that: in the stock model each thread would check out a connection as needed from the pool managed by the database (e.g., at the start of a web request), and then return it when finished (at the end of a request, for instance). |
I use gevent in only one thread, no multithreading intended. The first line of the program does the monkeypatching, so all the spawned threads should happen somewhere on C-level. Not sure exactly, what they're doing. From gevent, I have about 50-100 microthreads, that access the database without further synchronisation. With plain filestorage, this worked flawlessly. About |
By default, gevent uses a threadpool to handle hostname (DNS) lookups, and optionally certain types of I/O with FileObjectThread. Chances are the threads you see are pool threads that did DNS lookups, such as when you connect to the database. |
Yeah, the program does indeed a bunch of DNS lookups at that time, though the DB itself is accessed via a socket. So I guess these threads are unrelated to the problem then. |
Just for info the results of my further experiments with this:
I'm afraid this isn't too helpful yet, so I'll have some more tries in getting something reproducible together. My thoughts so far, please correct me if I'm drawing wrong conclusions:
|
I recently switched from running ZODB in-process to a client-server solution. Since I switched, I keep getting segfaults within the client process, that look like that:
The client is using gevent and accesses the database via zlibstorage/clientstorage. Not sure if the the gevent stuff is relevant in terms of thread safety and the crash may be related to that, but looking at several of these stack traces, they all seem to happen in this _BTree_get function.
If I somehow can provide more helpful debug output, please let me know.
Edit:
Doing some more experiments, I caught another segfault, this time in rangeSearch:
So I'm still clueless as before in terms of how to fix it, but I guess it's rather gevent+ClientStorage not playing well together, rather than BTrees, and I'll close the issue here.
The text was updated successfully, but these errors were encountered: