[Quickfix-users] Fwd: exception thrown in python with twisted logging
Brought to you by:
orenmnero
From: Robert P. <rob...@gm...> - 2006-09-25 20:08:36
|
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). (1) 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. (2) In addition, in a very simple application, I'm getting more of these Swig::DirectorMethodException' errors, and can't seem to determine the origin. Below I've included a simple, sample program and the gdb backtrace from when the program puked. The error occurs in the Initiator.block() method. Any ideas on the cause of these errors? thanks, rob ------------------------------------------------------------------- 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): 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 session from gdb and python2.3 ------------------------------------------------------------------ user@host src> gdb python2.3 GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"...(no debugging symbols found) Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) set args -u FIXQuoteClientStub.py (gdb) r Starting program: /usr/bin/python2.3 -u FIXQuoteClientStub.py (no debugging symbols found) (no debugging symbols found) [Thread debugging using libthread_db enabled] [New Thread -1208301888 (LWP 19118)] (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) 2006/09/25 15:30 -0400 [-] Log opened. 2006/09/25 15:30 -0400 [-] QuickFIXQuoteClient: created. SessionID = FIX.4.4:BLAH_TEST->BLAH [New Thread -1215657040 (LWP 19124)] 2006/09/25 15:33 -0400 [-] QuickFIXQuoteClient:toAdmin. 2006/09/25 15:33 -0400 [-] session ID = FIX.4.4:BLAH_TEST->BLAH 2006/09/25 15:33 -0400 [-] message = <message> <header> <field number="8"><![CDATA[FIX.4.4]]></field> <field number="35"><![CDATA[A]]></field> <field number="34"><![CDATA[22]]></field> <field number="49"><![CDATA[BLAH]]></field> <field number="52"><![CDATA[20060925-19:33:52.882]]></field> <field number="56"><![CDATA[BLAH]]></field> </header> <body> <field number="98"><![CDATA[0]]></field> <field number="108"><![CDATA[20]]></field> </body> <trailer> </trailer> </message> terminate called after throwing an instance of 'Swig::DirectorMethodException' Program received signal SIGABRT, Aborted. [Switching to Thread -1215657040 (LWP 19124)] 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 0x004e603d in FIX::Initiator::block (this=Variable "this" is not available. ) at Initiator.cpp:217 #9 0x002616bf in _wrap_Initiator_block (args=0xb796f8cc) at QuickfixPython.cpp:150095 #10 0x0099a961 in PyCFunction_Call () from /usr/lib/libpython2.3.so.1.0 #11 0x00977637 in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #12 0x009cca88 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #13 0x009cf196 in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #14 0x009cde89 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #15 0x009cf196 in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #16 0x0098ae6e in PyFunction_SetClosure () from /usr/lib/libpython2.3.so.1.0 #17 0x00977637 in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #18 0x009c92a0 in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.3.so.1.0 #19 0x009f1172 in _PyObject_GC_Del () from /usr/lib/libpython2.3.so.1.0 #20 0x00a67371 in start_thread () from /lib/tls/libpthread.so.0 #21 0x008c6ffe in clone () from /lib/tls/libc.so.6 (gdb) |