[Quickfix-developers] SocketInitiator under Java
Brought to you by:
orenmnero
|
From: David M. <Dav...@mo...> - 2003-03-31 09:43:28
|
Hi All,
Finally made some progress... I got a server program, ie, acceptor
based appliation, runnig... As I mentioned on my last mail, only got it
to send messages by using sendToTarget(Message, SessionID).
When I started working on the client app, initiator based application,
all hell broke loose :-) Basically, it turns out that NO application
works, as it simply aborts (on my home linux box, without a core. In the
office, thankfully, it does core, see listing below). Banzai also does
not work (I see the gui pop up briefly and then it dies).
After several hours yesterday, I was able to show that if the quickfix
library throws ANY exception, the app dies. Basically this happened
when I did not set the ReconnectInterval in the config file. The docs
say that this field is defaulted to 30 (and I see this from the
constructors which do set this to 30). The onInitialize tries to get
this value from the dictionary and if it does get it, it overrides the
30 default. If it does not find it, it catches the exception and
continues!!! THIS CAUSES THE APP TO DIE. Seems that someone does not
like any exceptions thrown even if they are caught.
To prove this, I commented the line out and the code then cored
elsewhere (on getHost() where the code tries to get the host with a
number attached (ie SocketConnectionHost0 ). If it does not find it, it
uses the standard on, ie, SocketConnectionHost ... But again, the fact
that an exception was thrown, blows the program...
Here is the listing of the stack when ReconnectInterval is not set...
#0 0x40076b41 in __kill () at __kill:-1
-1 __kill: No such file or directory.
in __kill
(gdb) where
#0 0x40076b41 in __kill () at __kill:-1
#1 0x4003879b in raise (sig=6) at signals.c:65
#2 0x400780c2 in abort () at ../sysdeps/generic/abort.c:88
#3 0x4035c0a2 in os::abort ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#4 0x403590ac in os::handle_unexpected_exception ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#5 0x4035cb2a in JVM_handle_linux_signal ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#6 0x4035b844 in signalHandler ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#7 0x40038b53 in pthread_sighandler_rt (signo=11, si=0xbfe0dc90,
uc=0xbfe0dd10) at signals.c:121
#8 <signal handler called>
#9 0x4060cd3a in __cplus_type_matcher (info=0x8297ef0,
match_info=0x4c939f54 <FIX::ConfigError type_info function>,
exception_table=0x0)
from /usr/lib/libstdc++-libc6.1-1.so.2
#10 0x4cb6a3bc in __eh_rtime_match (rtime=0x4c939f54)
from
/u/cwscs1_OR/monheit/projects/STLport-4.5.3/lib/libstlport_gcc.so
#11 0x4c9050be in FIX::SocketInitiator::getHost ()
from
/a/cwscs1/d/OR/monheit/projects/quickfix/src/java/.libs/libquickfix_jni.so.1.0.0
#12 0x4c9046f8 in FIX::SocketInitiator::doConnect ()
from
/a/cwscs1/d/OR/monheit/projects/quickfix/src/java/.libs/libquickfix_jni.so.1.0.0
#13 0x4c902428 in FIX::Initiator::connect ()
from
/a/cwscs1/d/OR/monheit/projects/quickfix/src/java/.libs/libquickfix_jni.so.1.0.0
#14 0x4c904653 in FIX::SocketInitiator::onStart ()
from
/a/cwscs1/d/OR/monheit/projects/quickfix/src/java/.libs/libquickfix_jni.so.1.0.0
#15 0x4c9026b6 in FIX::Initiator::start ()
from
/a/cwscs1/d/OR/monheit/projects/quickfix/src/java/.libs/libquickfix_jni.so.1.0.0
#16 0x4c8efb0d in Java_org_quickfix_SocketInitiator_doStart ()
from
/a/cwscs1/d/OR/monheit/projects/quickfix/src/java/.libs/libquickfix_jni.so.1.0.0
#17 0x4207412d in ?? ()
#18 0x4206cf93 in ?? ()
#19 0x4206d299 in ?? ()
#20 0x4206cf93 in ?? ()
#21 0x4206a195 in ?? ()
#22 0x402c04f6 in JavaCalls::call_helper ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#23 0x4035b44d in os::os_exception_wrapper ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#24 0x402c0644 in JavaCalls::call ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#25 0x402c85cd in jni_invoke ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#26 0x402d7bcd in jni_CallStaticVoidMethod ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#27 0x08049372 in strcpy () at strcpy:-1
#28 0x40064687 in __libc_start_main (main=0x8048c60 <strcpy+200>,
argc=5, ubp_av=0xbffeb054,
init=0x80488e8, fini=0x804ba0c <strcpy+11892>, rtld_fini=0x4000dcd4
<_dl_fini>, stack_end=0xbffeb04c)
Here is the listing if I do set ReconnectInterval ...
#0 0x40076b41 in __kill () at __kill:-1
#1 0x4003879b in raise (sig=6) at signals.c:65
#2 0x400780c2 in abort () at ../sysdeps/generic/abort.c:88
#3 0x4035c0a2 in os::abort ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#4 0x403590ac in os::handle_unexpected_exception ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#5 0x4035cb2a in JVM_handle_linux_signal ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#6 0x4035b844 in signalHandler ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#7 0x40038b53 in pthread_sighandler_rt (signo=11, si=0xbfe0dc90,
uc=0xbfe0dd10) at signals.c:121
#8 <signal handler called>
#9 0x4060cd3a in __cplus_type_matcher (info=0x82917a0,
match_info=0x4060d2c4 <exception type_info function>,
exception_table=0x0)
from /usr/lib/libstdc++-libc6.1-1.so.2
#10 0x4cb6a3bc in __eh_rtime_match (rtime=0x4060d2c4)
from
/u/cwscs1_OR/monheit/projects/STLport-4.5.3/lib/libstlport_gcc.so
#11 0x4c904581 in FIX::SocketInitiator::onInitialize ()
from
/a/cwscs1/d/OR/monheit/projects/quickfix/src/java/.libs/libquickfix_jni.so.1.0.0
#12 0x4c9025d2 in FIX::Initiator::start ()
from
/a/cwscs1/d/OR/monheit/projects/quickfix/src/java/.libs/libquickfix_jni.so.1.0.0
#13 0x4c8efb0d in Java_org_quickfix_SocketInitiator_doStart ()
from
/a/cwscs1/d/OR/monheit/projects/quickfix/src/java/.libs/libquickfix_jni.so.1.0.0
#14 0x4207412d in ?? ()
#15 0x4206cf93 in ?? ()
#16 0x4206d299 in ?? ()
#17 0x4206cf93 in ?? ()
#18 0x4206a195 in ?? ()
#19 0x402c04f6 in JavaCalls::call_helper ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#20 0x4035b44d in os::os_exception_wrapper ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#21 0x402c0644 in JavaCalls::call ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#22 0x402c85cd in jni_invoke ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#23 0x402d7bcd in jni_CallStaticVoidMethod ()
from
/ms/dist/msjava/PROJ/sunjdk/1.4.0_01/.exec/@sys/jre/lib/i386/client/libjvm.so
#24 0x08049372 in strcpy () at strcpy:-1
#25 0x40064687 in __libc_start_main (main=0x8048c60 <strcpy+200>,
argc=5, ubp_av=0xbffec954,
init=0x80488e8, fini=0x804ba0c <strcpy+11892>, rtld_fini=0x4000dcd4
<_dl_fini>, stack_end=0xbffec94c)
at ../sysdeps/generic/libc-start.c:129
This one dies on the getHost() call...
Has anyone seen this before? Did I compile this wrongly? I ended up
commenting out loads of code in the library until I got it to go as far
as "calling onStart()" in Initiator::start() but never got the "calling
thread_join" output... I did get the "doConnect is returning true".
Also did not get the "calling onRun()" message. The log file for
.events are update fine but the app dies right after that.
void Initiator::start() throw ( RuntimeError& )
{
onInitialize( m_settings );
int threadid = thread_spawn( &startThread, this );
if ( !threadid ) throw RuntimeError("Unable to spawn thread");
std::cout << "calling onStart()" << std::endl;
onStart();
std::cout << "calling thread_join()" << std::endl;
thread_join( threadid );
}
void* Initiator::startThread( void* p )
{
Initiator * pInitiator = static_cast < Initiator* > ( p );
std::cout << "calling onRun()" << std::endl;
pInitiator->getApplication().onRun();
pInitiator->stop();
return 0;
}
bool SocketInitiator::doConnect( const SessionID& s, const Dictionary& d
)
{
try
{
std::string address;
short port = 0;
Log* log = Session::lookupSession( s )->getLog();
getHost( s, d, address, port );
log->onEvent( "Connecting to " + address + " on port " +
IntConvertor::convert((unsigned short)port) );
int result = m_connector.connect( address, port );
if ( !result )
{
log->onEvent( "Connection failed" );
return false;
}
log->onEvent( "Connection succeeded" );
m_connections[ result ] = new SocketConnection
( *this, s, result,
&m_connector.getMonitor() );
std::cout << "doConnect is returning true" << std::endl;
return true;
}
catch ( std::exception& ) { return false; }
}
This has got something to do with exception thrwoing under linux... I
saw stuff about it in the archives... Any ideas?
David
--
NOTICE: If received in error, please destroy and notify sender. Sender
does not waive confidentiality or privilege, and use is prohibited.
|