
April 27th, 2005, 09:52 PM
|
|
Registered User
|
|
Join Date: Apr 2005
Posts: 1
Time spent in forums: 8 m 15 sec
Reputation Power: 0
|
|
|
Calling sqleintr or exit causes program (linux) to hang (due to deadlock by pthread)?
Hi all,
I have a program written in C with embeded SQL. Following are the configuration:
DB2/LINUX 8.1.5
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
My problems are as following
CASE 1:
In DB2's documentation, it is stated that sqleintr is safe to call in a signal handler. When my program is executing a SQL, it receives an interrupt. In the signal handler for the interrupt, it calls sqleintr() to stop the SQL and call exit() to exit the program. Sometime the program will hang when calling sqleintr because of pthread in DB2 cannot accquire a lock and the program goes into a deadlock (from the gdb dump ). I guest the lock is accquire somewhere during the excution of the SQL before the signal and it is not yet released.
CASE 2:
Same as above but the program sometime hang when calling exit(). From the gdb dump, exit() will call some clean up functions in DB2 and clean up functions itself goes into a dead lock as well.
For your information, I need to exit the program after the signal handler is called.
Does anyone encounter this problem before? I have search around at the DB2 documnetation but still can't find related information. Please help.
Thanks.
|