Bug #49937 [Com]: [PATCH] Race condition in PDOStatement

From: Date: Wed, 25 Aug 2010 06:27:32 +0000
Subject: Bug #49937 [Com]: [PATCH] Race condition in PDOStatement
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153773@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=49937&edit=1

 ID:                 49937
 Comment by:         kkaminski at itens dot pl
 Reported by:        basantk@php.net
 Summary:            [PATCH] Race condition in PDOStatement
 Status:             Assigned
 Type:               Bug
 Package:            PDO related
 Operating System:   Linux
 PHP Version:        5.2.11
 Assigned To:        basantk
 Block user comment: N

 New Comment:

basantk: As promised call stack (Visual Studio 2010) for my new problem
below:
	php5ts.dll!_zend_mm_free_int(_zend_mm_heap * heap, void * p)  Line 1979
+ 0x84 bytes	C
 	php5ts.dll!_efree(void * ptr)  Line 2311 + 0xb bytes	C
 	php5ts.dll!_zval_ptr_dtor(_zval_struct * * zval_ptr)  Line 415 + 0x25
bytes	C
 	php5ts.dll!zend_std_write_property(_zval_struct * object, _zval_struct
* member, _zval_struct * value, void * * * tsrm_ls)  Line 417 + 0xc
bytes	C
 	php_pdo.dll!pdo_stmt_construct(_pdo_stmt_t * stmt, _zval_struct *
object, _zend_class_entry * dbstmt_ce, _zval_struct * ctor_args, void *
* * tsrm_ls)  Line 447	C
 	php_pdo.dll!zim_PDO_prepare(int ht, _zval_struct * return_value,
_zval_struct * * return_value_ptr, _zval_struct * this_ptr, int
return_value_used, void * * * tsrm_ls)  Line 581 + 0x16 bytes	C
 	php5ts.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 200 + 0x3d bytes	C
 	php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 322 + 0x11 bytes	C
 	php5ts.dll!execute(_zend_op_array * op_array, void * * * tsrm_ls) 
Line 92 + 0xc bytes	C
 	php5ts.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 235	C
 	php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 322 + 0x11 bytes	C
 	php5ts.dll!execute(_zend_op_array * op_array, void * * * tsrm_ls) 
Line 92 + 0xc bytes	C
 	php5ts.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 235	C
 	php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 322 + 0x11 bytes	C
 	php5ts.dll!execute(_zend_op_array * op_array, void * * * tsrm_ls) 
Line 92 + 0xc bytes	C
 	php5ts.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 235	C
 	php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 322 + 0x11 bytes	C
 	php5ts.dll!execute(_zend_op_array * op_array, void * * * tsrm_ls) 
Line 92 + 0xc bytes	C
 	php5ts.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 235	C
 	php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 322 + 0x11 bytes	C
 	php5ts.dll!execute(_zend_op_array * op_array, void * * * tsrm_ls) 
Line 92 + 0xc bytes	C
 	php5ts.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 235	C
 	php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 322 + 0x11 bytes	C
 	php5ts.dll!execute(_zend_op_array * op_array, void * * * tsrm_ls) 
Line 92 + 0xc bytes	C
 	php5ts.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 235	C
 	php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(_zend_execute_data *
execute_data, void * * * tsrm_ls)  Line 322 + 0x11 bytes	C
 	php5ts.dll!execute(_zend_op_array * op_array, void * * * tsrm_ls) 
Line 92 + 0xc bytes	C
 	php5ts.dll!ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(_zend_execute_data
* execute_data, void * * * tsrm_ls)  Line 2106	C
 	php5ts.dll!execute(_zend_op_array * op_array, void * * * tsrm_ls) 
Line 92 + 0xc bytes	C
 	php5ts.dll!ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(_zend_execute_data
* execute_data, void * * * tsrm_ls)  Line 2106	C
 	php5ts.dll!execute(_zend_op_array * op_array, void * * * tsrm_ls) 
Line 92 + 0xc bytes	C
 	php5ts.dll!zend_execute_scripts(int type, void * * * tsrm_ls,
_zval_struct * * retval, int file_count, ...)  Line 1135	C
 	php5ts.dll!php_execute_script(_zend_file_handle * primary_file, void *
* * tsrm_ls)  Line 2036 + 0x12 bytes	C
 	php5apache2_2.dll!php_handler(request_rec * r)  Line 639 + 0xb bytes	C


Previous Comments:
------------------------------------------------------------------------
[2010-08-25 02:16:03] basantk@php.net

Sorry pajoye, I didn't know that there was a "patch upload" feature in
bug database. I somehow missed the link in webpage.

Anyway, I have attached the patch now. Thanks.

------------------------------------------------------------------------
[2010-08-25 02:13:17] basantk@php.net

The following patch has been added/updated:

Patch Name: pdo_race_condition_fix
Revision:   1282695197
URL:       
http://bugs.php.net/patch-display.php?bug=49937&patch=pdo_race_condition_fix&revision=1282695197

------------------------------------------------------------------------
[2010-08-24 20:31:38] pajoye@php.net

Please >attach< the patch to this report, upload it if you prefer. There
is a upload field for this exact purpose. Comments are for comments, not
for patches (which may loose their text format).

------------------------------------------------------------------------
[2010-08-24 20:17:04] basantk@php.net

pajoye, patch is already there in bug log. Look at the patch submitted
at  2009-
10-23 16:15 UTC. Http link to the same patch has been provided in
comments posted
at 2009-11-17 01:51 UTC. I posted the http link of the patch because it
makes it 
easier to commit.

(Unfortunately bug database don't have easy way to refer to comments #).

------------------------------------------------------------------------
[2010-08-24 19:38:20] kkaminski at itens dot pl

basantk: I used the patch you published in pdo_bug_52trunk.txt (this is
complete
patch, riight?). The patch fixed
my original problem but introduced a new one - in
pdo's constructor. As far I understood the code it is something with
memory
(de)allocation for queryString property.
I don't have access to crash dumps at the moment, but I will provide
full stack
trace tomorrow.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=49937


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=49937&edit=1


Thread (22 messages)

« previous php.bugs (#153773) next »