This is a discussion on AIX 5.3 ML5, cc_r vs cc_r7 dlopen crash problem within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hello group, I would like your help on the following problem I've got building an application under AIX with ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello group, I would like your help on the following problem I've got building an application under AIX with IBM VAC XL C/C++ 8 compiler. The application is multi- threaded. The compilation is made on AIX 5.1 with the latest version of XL C/C+ + : 8.0.0.13. To build the application, I first have to compile : - unixODBC 2.2.12 - Firebird 1.5.4 database - Firebird ODBC driver 1.3 These 3 packages make use of pthread library. So unixODBC is compiled with cc_r and Firebird database and Firebird ODBC driver are compiled with xlC_r (the later are C++ codes). All these package build without any problem. I then compile the final application (pure C with pthread application) which is dynamically linked with unixODBC. This final application is build with cc_r and the compilation work just fine and produce the final executable without any error or warning. Running the application on AIX 5.1, 5.2 and 5.3 up to ML4 is ok. It handles many parallel ODBC connections to the Firebird database just fine. But if I try to run it on AIX 5.3 ML5, the application crashes with SIGSEGV as soon as one thread makes a call to SQLDriverConnect and the call stack show the crash occurs in dlopen (when firebird driver try to load the firebird client library that implements the API to communicate with the firebird database server). The stack looks like this : Segmentation fault in load1 at 0xd0265184 ($t2) 0xd0265184 (load1+0x2c) 7c21616e stwux r1,r1,r12 (dbx) where load1(??, ??, ??, ??, ??) at 0xd0265184 loadAndInit() at 0xd012a7b8 dlopen(??, ??) at 0xd0300664 LoadDll__Q2_13IscDbcLibrary6CFbDllFPCcPCc() at 0xd1583bfc openDatabase__Q2_13IscDbcLibrary10AttachmentFPCcPQ 2_13IscDbcLibrary10Properties() at 0xd158268c openDatabase__Q2_13IscDbcLibrary13IscConnectionFPC cPQ2_13IscDbcLibrary10Properties() at 0xd157f774 connect__Q2_15OdbcJdbcLibrary14OdbcConnectionFPCcP CcPCcPCcPCcPCc() at 0xd1551fb0 sqlDriverConnect__Q2_15OdbcJdbcLibrary14OdbcConnec tionFPvPCUciPUcT3PsT3() at 0xd154f704 Main.SQLDriverConnect() at 0xd15664c8 SQLDriverConnect.SQLDriverConnect() at 0xd0e054d4 Connect() at 0x10002074 .... The crash occurs at the application initialization and at this point, it is guarantied that there is just one thread in the application in addition to the main thread of course. It is also guarantied that the main thread never calls any ODBC related functions. At the time the crash occurs, main is sleeping in a select on a TCP socket waiting for incoming client connections as shown by dbx below : (dbx) thread thread state-k wchan state-u k-tid mode held scope function $t1 run running 29671 u no pro select >$t2 run running 26387 k no pro load1 This is weird that this crash seems to be AIX 5.3 ML5 specific ... But that's not all. In fact, I found that if I link the final application with cc_r7 instead of cc_r, then this time the application no longer crashes on AIX 5.3 ML5 and seems to work perfectly well !!! Looking at IBM Fix Central web site, I found one fix for ML5 related to loadAndIni that seems to be close to my problem. It's the following fix : IY82846 : Seg fault requires thread-safe loadAndInit Applying the fix consist of updating xlC.aix50.rte and xlC.rte to the latest revision 8.0.0.9. However, this unfortunately does not solve my problem : the application still crashes with the same call stack :-( To be sure the problem is not actually a consequence of a bug in the final application, I have wrote a very basic (e.g. mono threaded) program that makes a call to SQLDriverConnect. And to my surprise, it works fine on ML5 ! Then I added muti-threading in that basic program : in main, I created a thread that calls SQLDriverConnect and I recompiled with cc_r. This time I've got the loadAndInit SEGV again ! And once again, compiling with cc_r7, the program works fine. I also tested another scenario for this basic test program : in main, I create a new thread that do some dummy work and in the main thread I call SQLDriverConnect. This time, the program works fine compiled either with cc_r or cc_r7. So it seems that the crash only occurs when the call to SQLDriverConnect is made from a thread that is not the main thread. Any idea ? Best regards, t o o n |
| ||||
| On Jun 7, 9:10 pm, grostoon <grost...@yahoo.com> wrote: > Hello group, > > I would like your help on the following problem I've got building an > application > under AIX with IBM VAC XL C/C++ 8 compiler. The application is multi- > threaded. > The compilation is made on AIX 5.1 with the latest version of XL C/C+ > + : 8.0.0.13. > > To build the application, I first have to compile : > - unixODBC 2.2.12 > - Firebird 1.5.4 database > - Firebird ODBC driver 1.3 > > These 3 packages make use of pthread library. So unixODBC is compiled > with cc_r and Firebird > database and Firebird ODBC driver are compiled with xlC_r (the later > are C++ codes). All these package build without any problem. > > I then compile the final application (pure C with pthread application) > which is dynamically linked with unixODBC. This final application is > build with cc_r and the compilation work just fine and produce the > final executable without any error or warning. > > Running the application on AIX 5.1, 5.2 and 5.3 up to ML4 is ok. It > handles many parallel ODBC connections to the Firebird database just > fine. > > But if I try to run it on AIX 5.3 ML5, the application crashes with > SIGSEGV as soon as one thread makes a call to SQLDriverConnect and the > call stack show the crash occurs in dlopen (when firebird driver try > to load the firebird client library that implements the API to > communicate with the firebird database server). > > The stack looks like this : > > Segmentation fault in load1 at 0xd0265184 ($t2) > 0xd0265184 (load1+0x2c) 7c21616e stwux r1,r1,r12 > (dbx) where > load1(??, ??, ??, ??, ??) at 0xd0265184 > loadAndInit() at 0xd012a7b8 > dlopen(??, ??) at 0xd0300664 > LoadDll__Q2_13IscDbcLibrary6CFbDllFPCcPCc() at 0xd1583bfc > openDatabase__Q2_13IscDbcLibrary10AttachmentFPCcPQ 2_13IscDbcLibrary10Proper*ties() > at 0xd158268c > openDatabase__Q2_13IscDbcLibrary13IscConnectionFPC cPQ2_13IscDbcLibrary10Pro*perties() > at 0xd157f774 > connect__Q2_15OdbcJdbcLibrary14OdbcConnectionFPCcP CcPCcPCcPCcPCc() at > 0xd1551fb0 > sqlDriverConnect__Q2_15OdbcJdbcLibrary14OdbcConnec tionFPvPCUciPUcT3PsT3() > at 0xd154f704 > Main.SQLDriverConnect() at 0xd15664c8 > SQLDriverConnect.SQLDriverConnect() at 0xd0e054d4 > Connect() at 0x10002074 > ... > > The crash occurs at the application initialization and at this point, > it is guarantied that there is just one thread in the application in > addition to the main thread of course. It is also guarantied that the > main thread never calls any ODBC related functions. At the time the > crash occurs, main is sleeping > in a select on a TCP socket waiting for incoming client connections as > shown by dbx below : > > (dbx) thread > thread state-k wchan state-u k-tid mode held scope > function > $t1 run running 29671 u no pro > select > > >$t2 run running 26387 k no pro load1 > > This is weird that this crash seems to be AIX 5.3 ML5 specific ... > > But that's not all. > In fact, I found that if I link the final application with cc_r7 > instead of cc_r, then this time the application no longer crashes on > AIX 5.3 ML5 and seems to work perfectly well !!! > > Looking at IBM Fix Central web site, I found one fix for ML5 related > to loadAndIni that seems to be close to my problem. It's the following > fix : > > IY82846 : Seg fault requires thread-safe loadAndInit > > Applying the fix consist of updating xlC.aix50.rte and xlC.rte to the > latest revision 8.0.0.9. > > However, this unfortunately does not solve my problem : the > application still crashes with the same > call stack :-( > > To be sure the problem is not actually a consequence of a bug in the > final application, I have wrote a very basic (e.g. mono threaded) > program that makes a call to SQLDriverConnect. And to my surprise, it > works fine on ML5 ! > > Then I added muti-threading in that basic program : in main, I created > a thread that calls SQLDriverConnect and I recompiled with cc_r. This > time I've got the loadAndInit SEGV again ! > And once again, compiling with cc_r7, the program works fine. > > I also tested another scenario for this basic test program : in main, > I create a new thread that do some dummy work and in the main thread I > call SQLDriverConnect. This time, the program works fine compiled > either with cc_r or cc_r7. So it seems that the crash only occurs when > the call to SQLDriverConnect is made from a thread that is not the > main thread. > > Any idea ? > > Best regards, > > t o o n Hi, For the interested ones, I found that updating bos.rte.libc from 5.3.0.50 to latest version (5.3.0.56) fixes the issue. So it seems that it was in fact a regression introduced in ML5's libc. t o o n |
| Thread Tools | |
| Display Modes | |
|
|