libgearman client: tasks is not freed in GEARMAN_COULD_NOT_CONNECT state

Bug #783141 reported by Herman J. Radtke III
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gearman
Fix Released
High
Brian Aker

Bug Description

in libgearman/client.cc
The _client_run_task() function does not free the task if the client could not connect to gearman.

Bug discovered here: http://pecl.php.net/bugs/bug.php?id=19365

In the second call to gearman_client_run_tasks(), the client object still has a valid task object referenced, but client->task->con is NULL. This will cause a segfault.

Backtrace:
(gdb) bt
#0 gearman_connection_send (connection=0x0, packet=0x11ed288, flush=true) at libgearman/connection.c:293
#1 0x00002aaaaeb2560a in _client_run_task (client=0x11c4620, task=0x11ed240) at libgearman/client.c:1076
#2 0x00002aaaaeb25a0c in _client_run_tasks (client=0x11c4620) at libgearman/client.c:719
#3 gearman_client_run_tasks (client=0x11c4620) at libgearman/client.c:900
#4 0x00002aaaae912984 in zif_gearman_client_run_tasks (ht=0, return_value=0x11c2470, return_value_ptr=0x0, this_ptr=0x11c24e8, return_value_used=0)
    at /home/hradtke/projects/php/src/pecl/gearman/trunk/php_gearman.c:3069
#5 0x0000000000906a60 in execute_internal (execute_data_ptr=0x2aaaaf584090, return_value_used=0) at /home/hradtke/tmp/php-5.3.6/Zend/zend_execute.c:1261
#6 0x00002aaaae4a1f4a in xdebug_execute_internal (current_execute_data=0x2aaaaf584090, return_value_used=0) at /home/hradtke/tmp/xdebug-2.1.0/xdebug.c:1339
#7 0x0000000000907e34 in zend_do_fcall_common_helper_SPEC (execute_data=0x2aaaaf584090) at /home/hradtke/tmp/php-5.3.6/Zend/zend_vm_execute.h:318
#8 0x0000000000908d92 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (execute_data=0x2aaaaf584090) at /home/hradtke/tmp/php-5.3.6/Zend/zend_vm_execute.h:421
#9 0x0000000000906e2a in execute (op_array=0x11c30e0) at /home/hradtke/tmp/php-5.3.6/Zend/zend_vm_execute.h:107
#10 0x00002aaaae4a1bc5 in xdebug_execute (op_array=0x11c30e0) at /home/hradtke/tmp/xdebug-2.1.0/xdebug.c:1272
#11 0x00000000008d3dd0 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/hradtke/tmp/php-5.3.6/Zend/zend.c:1194
#12 0x0000000000853202 in php_execute_script (primary_file=0x7fffffffe5d0) at /home/hradtke/tmp/php-5.3.6/main/main.c:2268
#13 0x00000000009ca0bd in main (argc=2, argv=0x7fffffffe828) at /home/hradtke/tmp/php-5.3.6/sapi/cli/php_cli.c:1193

Revision history for this message
Brian Aker (brianaker) wrote : Re: [Bug 783141] [NEW] libgearman client: tasks is not freed in GEARMAN_COULD_NOT_CONNECT state

Hi!

On May 15, 2011, at 11:40 AM, Herman J. Radtke III wrote:

> The _client_run_task() function does not free the task if the client could not connect to gearman.

I have this fixed in the build tree, I will be merging everything up again fairly soon.

Thanks,
 -Brian

Brian Aker (brianaker)
Changed in gearmand:
assignee: nobody → Brian Aker (brianaker)
status: New → In Progress
importance: Undecided → High
Brian Aker (brianaker)
Changed in gearmand:
status: In Progress → Fix Committed
Brian Aker (brianaker)
Changed in gearmand:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.