php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63576 Driver locks during commit after hitting max_execution_time
Submitted: 2012-11-21 22:15 UTC Modified: 2014-07-08 09:41 UTC
From: jelle dot vink at gmail dot com Assigned: rahulpriyadarshi (profile)
Status: Closed Package: ibm_db2 (PECL)
PHP Version: 5.3.18 OS: AIX / Linux
Private report: No CVE-ID: None
 [2012-11-21 22:15 UTC] jelle dot vink at gmail dot com
Description:
------------
When reaching max_execution_time on either db2_prepare() or db2_execute() the db2 
driver gets in a locked state from which it will not recover. At the DB2 server 
the UOW gets stuck as well and is never completed holding all it's row locks.

This behavior has been tested on both Linux (openSuse 12.1) and AIX.

AIX environment:

Server version: Apache/2.2.21 (Unix)
Server built:   Jan  9 2012 07:59:54

PHP 5.3.10 (cli) (built: Apr 23 2012 14:03:28) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

ibm_db2 
Module release 1.9.3
Module revision $Revision: 324113 $ 

Product name:                     "DB2 Enterprise Server Edition"
License type:                     "Trial"
Expiry date:                      "12/11/2012"
Product identifier:               "db2ese"
Version information:              "9.7"

Product name:                     "DB2 Connect Server"
License type:                     "Trial"
Expiry date:                      "12/11/2012"
Product identifier:               "db2consv"
Version information:              "9.7"

DB21085I  Instance "xxxx" uses "64" bits and DB2 code release "SQL09075"  with 
level identifier "08060107".
Informational tokens are "DB2 v9.7.0.5", "special_28024", "IP23285_28024", and 
Fix Pack "5".




Test script:
---------------
Test script can be downloaded at http://dev.skymeyer.be/download/lock_test.tar.gz


Expected result:
----------------
In the above test script the shutdown function should perform the db2_commit() 
and db2_close() and release the process back to apache.

Actual result:
--------------
During db2_commit() in the shutdown function the apache process gets stuck:

(gdb) thread 1
[Switching to thread 1 (process 7340126)]
#0  0xd04f974c in _global_lock_common () from /usr/lib/libpthread.a(shr_xpg5.o)
(gdb) backtrace
#0  0xd04f974c in _global_lock_common () from /usr/lib/libpthread.a(shr_xpg5.o)
#1  0xd0506f10 in _mutex_lock () from /usr/lib/libpthread.a(shr_xpg5.o)
#2  0xd6368de0 in sqloxltc_app@AF8_1 () from 
/home/db2cae/sqllib/lib32/libdb2.a(shr.o)
#3  0xd67882ac in CLI_dstRequestHLatch(short, unsigned char, long) () from 
/home/db2cae/sqllib/lib32/libdb2.a(shr.o)
#4  0xd68005f8 in SQLEndTran () from /home/db2cae/sqllib/lib32/libdb2.a(shr.o)
#5  0xd098610c in zif_db2_commit () from /opt/freeware/lib/php/modules/ibm_db2.so
#6  0xd11add4c in zend_do_fcall_common_helper_SPEC () from 
/opt/freeware/lib/httpd/modules/libphp5.so
#7  0xd11b3b10 in ZEND_DO_FCALL_SPEC_CONST_HANDLER () from 
/opt/freeware/lib/httpd/modules/libphp5.so
#8  0xd11abe6c in execute () from /opt/freeware/lib/httpd/modules/libphp5.so
#9  0xd1232d88 in zend_call_function () from 
/opt/freeware/lib/httpd/modules/libphp5.so
#10 0xd1235ec4 in call_user_function_ex () from 
/opt/freeware/lib/httpd/modules/libphp5.so
#11 0xd1235fc0 in call_user_function () from 
/opt/freeware/lib/httpd/modules/libphp5.so
#12 0xd137d22c in user_shutdown_function_call () from 
/opt/freeware/lib/httpd/modules/libphp5.so
#13 0xd118ca80 in zend_hash_apply () from 
/opt/freeware/lib/httpd/modules/libphp5.so
#14 0xd13750a0 in php_call_shutdown_functions () from 
/opt/freeware/lib/httpd/modules/libphp5.so
#15 0xd1280ba4 in php_request_shutdown () from 
/opt/freeware/lib/httpd/modules/libphp5.so
#16 0xd1634598 in php_apache_request_dtor () from 
/opt/freeware/lib/httpd/modules/libphp5.so
#17 0xd1634ea0 in php_handler () from /opt/freeware/lib/httpd/modules/libphp5.so
#18 0x1002fb20 in ap_run_handler ()
#19 0x1002fd08 in ap_invoke_handler ()
#20 0x10037314 in ap_process_request ()
#21 0x10031860 in ap_process_http_connection ()
#22 0x1001f460 in ap_run_process_connection ()
#23 0x1001f548 in ap_process_connection ()
#24 0x1002473c in child_main ()
#25 0x100249dc in make_child ()
#26 0x10024d78 in startup_children ()
#27 0x10025058 in ap_mpm_run ()
#28 0x10001b24 in main ()


At the DB2 server the UOW is never completed. This is part of the DB2 snapshot 
taken from the above client process:


            Application Snapshot

Application handle                         = 57193
Application status                         = UOW Waiting
Status change time                         = 11/21/2012 15:25:06.536053
Application code page                      = 1208
Application country/region code            = 1
DUOW correlation token                     = x.x.x.x.55229.121121202535
Application name                           = httpd
Application ID                             = x.x.x.x.55229.121121202535
Sequence number                            = 00001
TP Monitor client user ID                  =
TP Monitor client workstation name         =
TP Monitor client application name         =
TP Monitor client accounting string        =

Connection request start timestamp         = 11/21/2012 15:24:57.438380
Connect request completion timestamp       = 11/21/2012 15:24:57.440550
Application idle time                      = 3 minutes 17 seconds
CONNECT Authorization ID                   = XXXXX
Client login ID                            = apache
Configuration NNAME of client              = xxxx
Client database manager product ID         = SQL09075
Process ID of client application           = 7340126
Platform of client application             = AIX
Communication protocol of client           = TCP/IP

Lock timeout (seconds)                     = 120
Locks held by application                  = 20516
Lock waits since connect                   = 0
Time application waited on locks (ms)      = 0
Deadlocks detected                         = 0
Lock escalations                           = 0
Exclusive lock escalations                 = 0
Number of Lock Timeouts since connected    = 0
Total time UOW waited on locks (ms)        = 0

UOW log space used (Bytes)                 = 15480697
Previous UOW completion timestamp          = 11/21/2012 15:24:57.440550
Elapsed time of last completed uow (sec.ms)= 0.000000
UOW start timestamp                        = 11/21/2012 15:24:57.441620
UOW stop timestamp                         =
UOW completion status                      =



Sample backtrace on Linux:

(gdb) backtrace
#0  0x00007f2f6a79c8d4 in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x00007f2f6a7981c5 in _L_lock_883 () from /lib64/libpthread.so.0
#2  0x00007f2f6a79801a in pthread_mutex_lock () from /lib64/libpthread.so.0
#3  0x00007f2f5df23768 in sqloxltc_app () from 
/opt/ibm/db2/V9.7/lib64/libdb2.so.1
#4  0x00007f2f5e07f9a4 in CLI_dstRequestHLatch(short, unsigned char, int) () from 
/opt/ibm/db2/V9.7/lib64/libdb2.so.1
#5  0x00007f2f5e0c7b91 in SQLEndTran () from /opt/ibm/db2/V9.7/lib64/libdb2.so.1
#6  0x00007f2f5f6fd300 in zif_db2_commit (ht=<optimized out>, 
return_value=0x7f2f6b8dc018, return_value_ptr=<optimized out>, this_ptr=
<optimized out>, 
    return_value_used=<optimized out>) at /usr/local/ibm_db2-1.9.2/ibm_db2.c:3413
#7  0x00007f2f668b752d in ?? () from /usr/lib64/apache2/mod_php5.so
#8  0x00007f2f668576fb in execute () from /usr/lib64/apache2/mod_php5.so
#9  0x00007f2f65542c86 in ?? () from /usr/lib64/php5/extensions/ZendDebugger.so
#10 0x00007f2f668b6f2c in ?? () from /usr/lib64/apache2/mod_php5.so
#11 0x00007f2f668576fb in execute () from /usr/lib64/apache2/mod_php5.so
#12 0x00007f2f65542c86 in ?? () from /usr/lib64/php5/extensions/ZendDebugger.so
#13 0x00007f2f668b6f2c in ?? () from /usr/lib64/apache2/mod_php5.so
#14 0x00007f2f668576fb in execute () from /usr/lib64/apache2/mod_php5.so
#15 0x00007f2f65542c86 in ?? () from /usr/lib64/php5/extensions/ZendDebugger.so
#16 0x00007f2f668278b1 in zend_call_function () from 
/usr/lib64/apache2/mod_php5.so
#17 0x00007f2f66827c50 in call_user_function_ex () from 
/usr/lib64/apache2/mod_php5.so
#18 0x00007f2f66827ca2 in call_user_function () from 
/usr/lib64/apache2/mod_php5.so
#19 0x00007f2f667685c7 in ?? () from /usr/lib64/apache2/mod_php5.so
#20 0x00007f2f668414a4 in zend_hash_apply () from /usr/lib64/apache2/mod_php5.so
#21 0x00007f2f6676af86 in ?? () from /usr/lib64/apache2/mod_php5.so
#22 0x00007f2f667e1045 in php_request_shutdown () from 
/usr/lib64/apache2/mod_php5.so
#23 0x00007f2f668c02e7 in ?? () from /usr/lib64/apache2/mod_php5.so
#24 0x00007f2f6b2a5a88 in ap_run_handler()
#25 0x00007f2f6b2a5f0e in ap_invoke_handler ()
#26 0x00007f2f6b2b37a0 in ap_process_request ()
#27 0x00007f2f6b2b05d8 in ?? ()
#28 0x00007f2f6b2ac518 in ap_run_process_connection ()
#29 0x00007f2f6b2b8340 in ?? ()
#30 0x00007f2f6b2b8aaa in ?? ()
#31 0x00007f2f6b2b8b67 in ?? ()
#32 0x00007f2f6b2b94e4 in ap_mpm_run ()
#33 0x00007f2f6b2909aa in main ()



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-08 09:41 UTC] rahulpriyadarshi@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: rahulpriyadarshi
 [2014-07-08 09:41 UTC] rahulpriyadarshi@php.net
This issue has been handled and resolved through another mail thread.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Aug 26 09:01:26 2019 UTC