-
Notifications
You must be signed in to change notification settings - Fork 45
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
Segfault when running http://gearman.org/examples/multi-query/ #13
Comments
+1 thanks for the reproducible use case :) |
I am not a php-extension expert but I was able to track down the segfault to the following line static void gearman_task_obj_free(zend_object *object) {
// zval_dtor(intern->zclient);
} Commenting out "zval_dtor(intern->zclient);" made the segfault gone. I don't have a deep insight into the gearman module but to me it seems that the zclient property is a weak reference that should not be d'tored. The client holds the list of its tasks but the task should not manage the client reference. Right? |
Yes, probably that is the problem. Added a pull request for fix. |
I am not sure if the zClient should be destructed at this point at all. The task owns its workload and data but it does not own the client. The client owns the task. I'm not a php-ext expert but this is what my general programming experience says :) |
zval_dtor should only destroy the object fully if the refcount is 0. We might need to include an zref_add every time we use this object. Just for my own sanity as I sort through these, can you try the latest build to see if you can replicate? I know you said you were going to need a few days first. |
hey @vladnis, I merged a bunch of fixes from other pull requests. I did make a minor fix in which GearmanWorker::addServer's params should be optional, but otherwise the pull requests elsewhere seem to have fixed the multi-query example. Can you grab HEAD and test again on your end? thanks! |
The Segfault is resolved. But, I saw that if you left addServer to get defaults parameters, it does not seem to connect to 127.0.0.1:4730. It rather remains blocked. I can close this bug. Should I create a new one for the above problem? Thanks. |
No, I'll just patch that up real fast :) thanks! Update: @vladnis can you actually open up an issue? I'm actually able to use the defaults when creating a worker. localhost:4730, right? |
Hi,
I got the following error when running the example form http://gearman.org/examples/multi-query/, with PHP7, and gearman plugin built from master :
Program received signal SIGSEGV, Segmentation fault.
0x00005555557a9de0 in _zval_dtor_func ()
(gdb) bt
#0 0x00005555557a9de0 in _zval_dtor_func ()
#1 0x00007fffed2f4f9a in _zval_dtor (zvalue=)
#2 gearman_task_obj_free (object=0x7ffff386f0f8) at /tmp/gearman/php_gearman.c:3757
#3 0x00005555557e763a in zend_objects_store_del ()
#4 0x00005555557bcc0f in zend_array_destroy ()
#5 0x00007fffed2f52e3 in _zval_dtor (zvalue=)
#6 gearman_client_obj_free (object=0x7ffff38789f8) at /tmp/gearman/php_gearman.c:3609
#7 0x00005555557e763a in zend_objects_store_del ()
#8 0x00005555557be03c in zend_hash_reverse_apply ()
#9 0x000055555579bf05 in shutdown_destructors ()
#10 0x00005555557ab687 in zend_call_destructors ()
#11 0x000055555574b1a5 in php_request_shutdown ()
#12 0x000055555583f579 in ?? ()
#13 0x0000555555636524 in main ()
The text was updated successfully, but these errors were encountered: