php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59707 GearmanJob::setReturn causes segfault
Submitted: 2011-04-10 16:04 UTC Modified: 2011-05-15 05:38 UTC
From: hradtke@php.net Assigned: hradtke (profile)
Status: Closed Package: gearman (PECL)
PHP Version: Trunk SVN-2011-04-10 (dev) OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: hradtke@php.net
New email:
PHP Version: OS:

 

 [2011-04-10 16:04 UTC] hradtke@php.net
Description:
------------
Using GearmanJob::setReturn will cause the worker to segfault and send a return code of GEARMAN_WORK_FAIL.

Reproduce code:
---------------
<?php
$gmworker= new GearmanWorker();
$gmworker->addServer();
$gmworker->addFunction("func", "func");

while($gmworker->work());

function func($job)
{
    $job->setReturn(GEARMAN_SUCCESS);
}
?>

Expected result:
----------------
A return code of GEARMAN_SUCCESS sent back to the client.

Actual result:
--------------
A return code of GEARMAN_WORK_FAIL is sent to the client and the worker segfaults.

Backtrace:
Starting program: /usr/local/php5.3.3/bin/php worker.php
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00000000008a1f4a in zend_object_store_get_object (zobject=0x0)
    at /home/hradtke/tmp/php-5.3.3/Zend/zend_objects_API.c:270
270             zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
(gdb) bt
#0  0x00000000008a1f4a in zend_object_store_get_object (zobject=0x0)
    at /home/hradtke/tmp/php-5.3.3/Zend/zend_objects_API.c:270
#1  0x00002aaaaeb20ec7 in zif_gearman_job_set_return (ht=1,
    return_value=0x114b0c0, return_value_ptr=0x0, this_ptr=0x114ad60,
    return_value_used=0)
    at /home/hradtke/projects/php/src/pecl/gearman/trunk/php_gearman.c:1651
#2  0x00000000008a4706 in execute_internal (execute_data_ptr=0x2aaaaf5802d8,
    return_value_used=0)
    at /home/hradtke/tmp/php-5.3.3/Zend/zend_execute.c:1261
#3  0x00002aaaae6b4f4a in xdebug_execute_internal (
    current_execute_data=0x2aaaaf5802d8, return_value_used=0)
    at /home/hradtke/tmp/xdebug-2.1.0/xdebug.c:1339
#4  0x00000000008a589a in zend_do_fcall_common_helper_SPEC (
    execute_data=0x2aaaaf5802d8)
    at /home/hradtke/tmp/php-5.3.3/Zend/zend_vm_execute.h:318
#5  0x00000000008a6662 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (
    execute_data=0x2aaaaf5802d8)
    at /home/hradtke/tmp/php-5.3.3/Zend/zend_vm_execute.h:421
#6  0x00000000008a4a53 in execute (op_array=0x116cab0)
    at /home/hradtke/tmp/php-5.3.3/Zend/zend_vm_execute.h:107
#7  0x00002aaaae6b4bc5 in xdebug_execute (op_array=0x116cab0)
    at /home/hradtke/tmp/xdebug-2.1.0/xdebug.c:1272
#8  0x0000000000864346 in zend_call_function (fci=0x7fffffffbb90,
    fci_cache=0x7fffffffbb60)
    at /home/hradtke/tmp/php-5.3.3/Zend/zend_execute_API.c:963
#9  0x00002aaaaeb26a40 in _php_worker_function_callback (job=0x114a860,
    context=0x114ac70, result_size=0x114a110, ret_ptr=0x7fffffffbc54)
    at /home/hradtke/projects/php/src/pecl/gearman/trunk/php_gearman.c:3434
#10 0x0000003fd34067c8 in gearman_worker_work (worker=0x114a0f8)
    at libgearman/worker.c:829
#11 0x00002aaaaeb26fd9 in zif_gearman_worker_work (ht=0,
    return_value=0x114ace8, return_value_ptr=0x0, this_ptr=0x1146220,
    return_value_used=1)
    at /home/hradtke/projects/php/src/pecl/gearman/trunk/php_gearman.c:3537
#12 0x00000000008a4706 in execute_internal (execute_data_ptr=0x2aaaaf580090,
    return_value_used=1)
    at /home/hradtke/tmp/php-5.3.3/Zend/zend_execute.c:1261
#13 0x00002aaaae6b4f4a in xdebug_execute_internal (
    current_execute_data=0x2aaaaf580090, return_value_used=1)
    at /home/hradtke/tmp/xdebug-2.1.0/xdebug.c:1339
#14 0x00000000008a589a in zend_do_fcall_common_helper_SPEC (
    execute_data=0x2aaaaf580090)
    at /home/hradtke/tmp/php-5.3.3/Zend/zend_vm_execute.h:318
#15 0x00000000008a6662 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (
    execute_data=0x2aaaaf580090)
    at /home/hradtke/tmp/php-5.3.3/Zend/zend_vm_execute.h:421
#16 0x00000000008a4a53 in execute (op_array=0x1146ee0)
    at /home/hradtke/tmp/php-5.3.3/Zend/zend_vm_execute.h:107
#17 0x00002aaaae6b4bc5 in xdebug_execute (op_array=0x1146ee0)
    at /home/hradtke/tmp/xdebug-2.1.0/xdebug.c:1272
#18 0x000000000087449b in zend_execute_scripts (type=8, retval=0x0,
    file_count=3) at /home/hradtke/tmp/php-5.3.3/Zend/zend.c:1194
#19 0x00000000007fe9f3 in php_execute_script (primary_file=0x7fffffffe620)
    at /home/hradtke/tmp/php-5.3.3/main/main.c:2260
---Type <return> to continue, or q <return> to quit---
#20 0x0000000000963752 in main (argc=2, argv=0x7fffffffe878)
    at /home/hradtke/tmp/php-5.3.3/sapi/cli/php_cli.c:1192

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-15 05:38 UTC] hradtke@php.net
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC