Re: [cx-oracle-users] cx_Oracle messes up signals
Brought to you by:
atuining
|
From: Gaius H. <ga...@ga...> - 2014-08-06 11:49:17
|
This is not cx_Oracle - it is the Oracle client libraries.
Gaius
From: CRV§ADER//KY
Sent: Wednesday, 6 August 2014 12:35
To: cx-...@li...
Reply To: cx-...@li...
Subject: [cx-oracle-users] cx_Oracle messes up signals
Hi all,
I'm using cx_Oracle 5.1.2 on Python 2.6 on Linux.
I found out that cx_Oracles interferes heavily with signal handling.
This is BAD, because it causes mysterious failures later on in the
code. It personally took me A LOT of time to figure what the heck was
going on.
Expected behaviour would be for cx_Oracle to respect whatever signal
handling is used in the code invoking the library. If you _really_
need to touch signals, that should be done in a subprocess.
Thanks
proof-of-concept code:
#!/usr/bin/env python
import cx_Oracle
import subprocess
import signal
import time
import os
from threading import Thread
def signalme():
time.sleep(2)
os.kill(os.getpid(), signal.SIGWINCH)
# Completely ignore SIGWINCH
signal.signal(signal.SIGWINCH, signal.SIG_IGN)
signal.siginterrupt(signal.
SIGWINCH, False)
print "do a syscall"
Thread(target=signalme).start()
subprocess.check_call("sleep 5", shell=True)
print "run oracle"
connection = cx_Oracle.connect('myuser', 'mypass', 'mytns')
connection.close()
print "do a syscall"
Thread(target=signalme).start()
subprocess.check_call("sleep 5", shell=True)
print "all done!"
Output:
do a syscall
run oracle
do a syscall
Traceback (most recent call last):
File "./oracle_test.py", line 30, in <module>
subprocess.check_call("sleep 5", shell=True)
File "/algo/algos2dev4/AlgoOne-EC/third-party-apps/python/lib/python2.6/subprocess.py",
line 457, in check_call
retcode = call(*popenargs, **kwargs)
File "/algo/algos2dev4/AlgoOne-EC/third-party-apps/python/lib/python2.6/subprocess.py",
line 444, in call
return Popen(*popenargs, **kwargs).wait()
File "/algo/algos2dev4/AlgoOne-EC/third-party-apps/python/lib/python2.6/subprocess.py",
line 1123, in wait
pid, sts = os.waitpid(self.pid, 0)
OSError: [Errno 4] Interrupted system call
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
cx-oracle-users mailing list
cx-...@li...
https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
|