[Quickfix-developers] exception thrown in python with twisted logging
Brought to you by:
orenmnero
From: Robert P. <rob...@gm...> - 2006-09-25 19:32:18
|
Hi folks, I'm using the python binding from quickfix 1.12.4, and seeing a possible bug in the python interface to the Application class. The platform is CentOS 4.4 (equiv to RHEL 4, update 4). Basically in C++, defining the method FIX::MyApplication::onCreate(const FIX::SessionID& sessionID ) { cout << sessionID.toString() << endl; } works, and prints the session ID as a string when the session is instantiated, but under python, the code: class MyApplication(quickfix.Application): def onCreate(self, sessionID): print "Session ID = " + sessionID throws an exception when called: "terminate called after throwing an instance of 'Swig::DirectorMethodException' ". However, calling sessionID.toString() here instead works. In addition, Is it possible that onCreate is being called before the session is instantiated in the SWIG interface, or the ? It should be very easy to reproduce the bug, since all that is needed it to call import quickfix import time, sys from twisted.python import log class QuickFIXQuoteClient(quickfix.Application): def onCreate(self, sessionID): log.msg("QuickFIXQuoteClient: created. SessionID = " + sessionID.toString()) def onLogon(self, sessionID): return def onLogout(self, sessionID): return # def toAdmin(self, message, sessionID): return def toAdmin(self, message, sessionID): log.msg("QuickFIXQuoteClient:toAdmin." ) log.msg(" session ID = " + sessionID.toString() ) log.msg(" message = \n"+message.toXML()) def toApp(self, message, sessionID): return def fromAdmin(self, message, sessionID): return def fromApp(self, message, sessionID): return fileName = "config.conf" settings = quickfix.SessionSettings(fileName) application = QuickFIXQuoteClient() storeFactory = quickfix.FileStoreFactory(settings) logFactory = quickfix.FileLogFactory(settings) initiator = quickfix.SocketInitiator(application, storeFactory, settings, logFactory) initiator.start() while 1 == 1 : time.sleep(1) print "waiting..." initiator.stop() ------------------------------------------------------ The following is a stacktrace from gdb python2.3 ------------------------------------------------------ terminate called after throwing an instance of 'Swig::DirectorMethodException' Program received signal SIGABRT, Aborted. [Switching to Thread -1208904000 (LWP 2747)] 0x007e67a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 (gdb) bt #0 0x007e67a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 #1 0x008267a5 in raise () from /lib/tls/libc.so.6 #2 0x00828209 in abort () from /lib/tls/libc.so.6 #3 0x00b4a14b in __gnu_cxx::__verbose_terminate_handler () from /usr/lib/libstdc++.so.6 #4 0x00b47e61 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.6 #5 0x00b47e96 in std::terminate () from /usr/lib/libstdc++.so.6 #6 0x00b47eab in std::terminate () from /usr/lib/libstdc++.so.6 #7 0x00b47da3 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.6 #8 0x0044178a in FIX::SessionFactory::create (this=0xbffcbb30, sessionID=@0x9e02588, settings=@0x9e17974) at /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ext/new_allocator.h:69 #9 0x00456758 in FIX::Initiator::initialize (this=0x9e006c8) at /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_tree.h:246 #10 0x004575c5 in Initiator (this=0x9e006c8, application=@0x9e03af0, messageStoreFactory=@0x9de00a0, settings=@0x9c7d5c8, logFactory=@0x9dfbf38) at Initiator.cpp:60 #11 0x0045d4d1 in SocketInitiator (this=0x9e006c8, application=@0x9e03af0, factory=@0x9de00a0, settings=@0x9c7d5c8, logFactory=@0x9dfbf38) at SocketInitiator.cpp:49 #12 0x001d177d in _wrap_new_SocketInitiatorBase (self=0x0, args=0xb78d384c) at QuickfixPython.cpp:150717 #13 0x0099a961 in PyCFunction_Call () from /usr/lib/libpython2.3.so.1.0 #14 0x00977637 in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #15 0x009cca88 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #16 0x009cf196 in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #17 0x0098ae6e in PyFunction_SetClosure () from /usr/lib/libpython2.3.so.1.0 #18 0x00977637 in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #19 0x0097edc8 in PyMethod_New () from /usr/lib/libpython2.3.so.1.0 #20 0x00977637 in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #21 0x009ccc6f in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #22 0x009cf196 in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #23 0x0098ae6e in PyFunction_SetClosure () from /usr/lib/libpython2.3.so.1.0 #24 0x00977637 in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #25 0x0097edc8 in PyMethod_New () from /usr/lib/libpython2.3.so.1.0 #26 0x00977637 in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #27 0x009af93c in _PyObject_SlotCompare () from /usr/lib/libpython2.3.so.1.0 #28 0x009a8d1c in PyType_IsSubtype () from /usr/lib/libpython2.3.so.1.0 #29 0x00977637 in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #30 0x009ccc6f in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #31 0x009cf196 in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #32 0x009cf45d in PyEval_EvalCode () from /usr/lib/libpython2.3.so.1.0 #33 0x009e8917 in PyErr_Display () from /usr/lib/libpython2.3.so.1.0 #34 0x009e9a42 in PyRun_SimpleFileExFlags () from /usr/lib/libpython2.3.so.1.0 #35 0x009eaa94 in PyRun_AnyFileExFlags () from /usr/lib/libpython2.3.so.1.0 #36 0x009ef78e in Py_Main () from /usr/lib/libpython2.3.so.1.0 #37 0x080485b2 in main () |