Details
- Type:
Bug
- Status: Resolved
- Priority:
Major
- Resolution: Fixed
- Affects Version/s: 3.3.0
- Fix Version/s: None
- Component/s: None
- Labels:None
Description
Activity
- All
- Work Log
- History
- Activity
- Transitions
Thanks, we use servers with ubuntu 9.10 32 bit and the python from the repository (version 2.6.4)
Adding link - 631 should hopefully resolve this.
Fixed as part of
ZOOKEEPER-631
I applied the patch but i've got again a segfault:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xad244b70 (LWP 18205)]
0x080611d5 in PyObject_Call (func=0x87fa8a0, arg=0xb53d9b4, kw=0x0) at ../Objects/abstract.c:2488
2488 ../Objects/abstract.c: No such file or directory.
in ../Objects/abstract.c
(gdb) bt
#0 0x080611d5 in PyObject_Call (func=0x87fa8a0, arg=0xb53d9b4, kw=0x0) at ../Objects/abstract.c:2488
#1 0x080d6ef2 in PyEval_CallObjectWithKeywords (func=0x87fa8a0, arg=0xb53d9b4, kw=0x0) at ../Python/ceval.c:3575
#2 0x080612a0 in PyObject_CallObject (o=0x87fa8a0, a=0xb53d9b4) at ../Objects/abstract.c:2480
#3 0x0047afb2 in watcher_dispatch (zzh=0x8617038, type=-1, state=1, path=0x8631028 "", context=0x8617258) at src/c/zookeeper.c:419
#4 0x00497559 in do_foreach_watcher (zh=0x8617038, type=-1, state=1, path=0x8631028 "", list=0x8a71088) at src/zk_hashtable.c:275
#5 deliverWatchers (zh=0x8617038, type=-1, state=1, path=0x8631028 "", list=0x8a71088) at src/zk_hashtable.c:317
#6 0x0048be3c in process_completions (zh=0x8617038) at src/zookeeper.c:1766
#7 0x0049806b in do_completion (v=0x8617038)
I'm not sure it's resolved.
Ok, thanks for the update. Can you share the code that you are running to give the segfault? That will make it much easier for me to diagnose.
henry,
looks like we can move this out of 3.3.1 release. Do you wnat to assign this to just 3.4?
Can't reproduce, or diagnose without code, moving to 3.4.0.
The common cases is when you supply a watcher for a get().
Start a zk server on localhost and create a node /zk.
Connect a python process like this:
import sys
import zookeeper
zh = zookeeper.init('localhost:2181')
def _zk_callback(*args):
print >> sys.stderr, "_zk_callback", args
zookeeper.get(zh, '/zk', _zk_callback)
Kill the zk server. The client will idle fine. When restarting the zk server, I get a SIGSEGV on reconnect 100% of the time.
This is fixed by the following patch:
[msolomon]yuriko:~/src/zookeeper-3.3.1/src/contrib/zkpython> svn di
Index: src/c/zookeeper.c
===================================================================
— src/c/zookeeper.c (revision 951628)
+++ src/c/zookeeper.c (working copy)
@@ -436,7 +436,9 @@
if (PyObject_CallObject((PyObject*)callback, arglist) == NULL)
- if (pyw->permanent == 0) {
+ // msolomon: when a session event happens, watchers get dispatched,
+ // but they are retained in the C client for dispatch again.
+ if (pyw->permanent == 0 && type != ZOO_SESSION_EVENT) { free_pywatcher(pyw); }
PyGILState_Release(gstate);
Mike -
Great catch, thanks for figuring this out.
I'm correct in saying that this doesn't prevent watchers from eventually being correctly freed, right?
If so, then it would be great if you could submit this patch formally so that we can get it into trunk. See for details.
Thanks,
Henry
I've created a patch as Mike suggested. I've been able to reproduce the issue and the change seems to fix it. I don't know if it prevent watchers from eventually being correctly freed. I've also run all the tests and everything seems to work fine.
ZOOKEEPER-740.patch fixes the crash, though it looks like the pywatcher_t will be leaked on an unrecoverable session state change (EXPIRED_SESSION_STATE or AUTH_FAILED_STATE). Attached a proposed revision to ZOOKEEPER-888 for your review.
It seems like this issue is fixed on the trunk by patch
ZOOKEEPER-888 but unfortunately the 3.3 branch still gives a segfault. I've tested using the code sample provided by Mike Solomon.
-1 overall. Here are the results of testing the latest attachment
against trunk revision 1033155.
 patch is failing to apply. Could someone update and resubmit?
I had also uploaded a
ZOOKEEPER-888 patch based on the 3.3 branch ( ZOOKEEPER-888-3.3.patch). Maybe that helps?
Any update on this? Should we try and get this to 3.4 release?
Moving this out to 3.5 release.
This issue has been fixed in 3.4 by
ZOOKEEPER-888.
Thanks for the bug report, Federico. There are a few similar issues with zkpython that are surely related - I must make sure to address them soon.
Can you let me know what version of Python and what operating system you are running?