Re: [Quickfix-developers] Seg fault in libc.so while working with quickfix from Java
Brought to you by:
orenmnero
From: Gene G. <mus...@ya...> - 2003-03-19 02:35:52
|
This, as Sergey discovered the hard way, is what happens on Linux when the initiator's SocketConnectHost is invalid. The reason is that Quickfix Utility.cpp and SocketConnector.cpp ignore bad return from gethostbyname. This is easily reproducible on Linux by changing SocketConnectHost in cfg/tradeclient.cfg and banzai.cfg to something random. Both C++ and JNI client will fail with segfaults when session connect will be attempted. The chain of events is as follows: Invalid host name is specified in call to socket_createConnector socket_createConnector calls socket_hostname socket_hostname calls gethostbyname which returns NULL socket_hostname in turn returns NULL, which gets passes as an argument to inet_addr inet_addr calls inet_aton internally, which crashes because its parameter is NULL instead of required pointer. Here is the two patches that fix this problem. Stylistically there is some code overlap between Utility.cpp and SocketConnector.cpp, which in the best of worlds should be eliminated, but I prefer my patches to be minimally invasive. Gene --- Sergey Gribov <se...@se...> wrote: > Hello, > > We have the following problem while working from > Java: > at a start time the Java application which uses the > quickfix > version 1.3.2 it fails with the following exception: > > > An unexpected exception has been detected in native > code outside the VM. > Unexpected Signal : 11 occurred at PC=0x40149C73 > Function=inet_aton+0x3F > Library=/lib/libc.so.6 > > Current Java thread: > at > org.quickfix.SocketInitiator.doStart(Native Method) > at > org.quickfix.SocketInitiator.start(Unknown Source) > ..... > > Anybody saw something like this? > Some other quickfix Java applications seems to be > working fine... > > Any idea what can cause it? > > Thanks in advance, > > -- > //========================================================================\\ > Sergey Gribov | A > specialist is someone who > E-Mail: se...@se... | learns more > and more about less > WWW: http://www.sergey.com/ | and less, > and ends up knowing > Phone: (617)7101683 | everything > about nothing... > \\========================================================================// > > > > ------------------------------------------------------- > This SF.net email is sponsored by:Crypto Challenge > is now open! > Get cracking and register here for some mind > boggling fun and > the chance of winning an Apple iPod: > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com |