Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #9961 > unrolled thread

JNI lib crash, with a change in a .c file which is not included in the Makefile

Started byaqura <chandra.vikas21@gmail.com>
First post2011-09-09 01:44 -0700
Last post2011-09-09 10:39 -0400
Articles 8 — 4 participants

Back to article view | Back to comp.lang.c++


Contents

  JNI lib crash, with a change in a .c file which is not included in the Makefile aqura <chandra.vikas21@gmail.com> - 2011-09-09 01:44 -0700
    Re: JNI lib crash, with a change in a .c file which is not included in the Makefile jacob navia <jacob@spamsink.net> - 2011-09-09 11:17 +0200
      Re: JNI lib crash, with a change in a .c file which is not included in the Makefile aqura <chandra.vikas21@gmail.com> - 2011-09-09 03:41 -0700
        Re: JNI lib crash, with a change in a .c file which is not included in the Makefile jacob navia <jacob@spamsink.net> - 2011-09-09 13:52 +0200
          Re: JNI lib crash, with a change in a .c file which is not included in the Makefile aqura <chandra.vikas21@gmail.com> - 2011-09-09 05:50 -0700
    Re: JNI lib crash, with a change in a .c file which is not included in the Makefile Edek <edek.pienkowski@gmail.com> - 2011-09-09 16:05 +0200
      Re: JNI lib crash, with a change in a .c file which is not included in the Makefile jacob navia <jacob@spamsink.net> - 2011-09-09 16:22 +0200
    Re: JNI lib crash, with a change in a .c file which is not included in the Makefile Victor Bazarov <v.bazarov@comcast.invalid> - 2011-09-09 10:39 -0400

#9961 — JNI lib crash, with a change in a .c file which is not included in the Makefile

Fromaqura <chandra.vikas21@gmail.com>
Date2011-09-09 01:44 -0700
SubjectJNI lib crash, with a change in a .c file which is not included in the Makefile
Message-ID<b6c8d5cc-4703-4072-940b-f7436a655c3a@i2g2000yqm.googlegroups.com>
We are facing an unusual problem, our JNI lib crashes at load time. we
use CentOS 5.4/G++ and VS2005 for development.

scenario: we are currently working on an enhancement in our product
and wanted to pass the new information back to the Java server code
using JNI. our C/C++ code works fine and we have tested it by running
for around 6 hours or so in our dev environment. we have updated two
result structure(which were already present) with one long value each
to pass on the result of our new enhancement.

when we updated the JNI code to pass on the result to Java code, we
found that Java server is crashing while loading JNI, we did debugging
and found that JNI lib crashes, even, when we do not have our changes
in JNI lib code base.

in our further debugging we found that, JNI Makefile includes a .c
file(aa.c), which has a couple of our changes for the new enhancement;
we started with commenting our changes in this aa.c file one by one
and found that the crash happens only when we have BBB.cpp::method1()
call(which we have added, as part of our new enhancement).

The unusual part is, this .c file(aa.c) is not needed in the JNI lib
and we do not have any methods of aa.c called from JNI lib; Now we
have removed aa.c from the JNI Makefile and compile just fine, but
still crashes when we have BBB.cpp::method1() call, if we remove this
method1() call then it works fine.

we are not sure, why/how it is linking to a file which is not
included, in the Makefile and crashing.

this is the error log we see

AgentServer#0 started: OK 12750 [Connection#Cnx:#0.0.1026:0 -
Session#c0s1] ERROR com.xx.xxx.xxxx - Unable to load JNI BBBController
Library java.lang.UnsatisfiedLinkError: /opt/XXXXX/lib/libjnixxx.so:
Can't load IA 32-bit .so on a IA 32-bit platform at
java.lang.ClassLoader$NativeLibrary.load(Native Method) at
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751) at
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676) at
java.lang.Runtime.loadLibrary0(Runtime.java:822) at
java.lang.System.loadLibrary(System.java:993)

Please suggest, any idea's would be appreciated.

Thanks in advance,

Aqura

[toc] | [next] | [standalone]


#9962

Fromjacob navia <jacob@spamsink.net>
Date2011-09-09 11:17 +0200
Message-ID<j4cljl$9i0$1@speranza.aioe.org>
In reply to#9961
Le 09/09/11 10:44, aqura a écrit :
> We are facing an unusual problem, our JNI lib crashes at load time. we
>
[snip]

> Please suggest, any idea's would be appreciated.
>
> Thanks in advance,
>
> Aqura

1) This is a difficult problem, try to hire a consultant to do that for 
you...

2) But anyway: Did you change the compiler version between the old 
version and the new one? This looks like a binary incompatibility.

3) What do you mean by "crashes at load time"? A segmentation fault
    or just an error message?

    If it is an error message it is probably 100% a compiler version
issue. Restore your old compiler and recompile.

[toc] | [prev] | [next] | [standalone]


#9970

Fromaqura <chandra.vikas21@gmail.com>
Date2011-09-09 03:41 -0700
Message-ID<6dee28ae-d35f-4ec8-b09b-4d799972e533@u20g2000yqj.googlegroups.com>
In reply to#9962
On Sep 9, 2:17 pm, jacob navia <ja...@spamsink.net> wrote:
> Le 09/09/11 10:44, aqura a crit :> We are facing an unusual problem, our JNI lib crashes at load time. we
>
> [snip]
>
> > Please suggest, any idea's would be appreciated.
>
> > Thanks in advance,
>
> > Aqura
>
> 1) This is a difficult problem, try to hire a consultant to do that for
> you...
>
> 2) But anyway: Did you change the compiler version between the old
> version and the new one? This looks like a binary incompatibility.
>
> 3) What do you mean by "crashes at load time"? A segmentation fault
>     or just an error message?
>
>     If it is an error message it is probably 100% a compiler version
> issue. Restore your old compiler and recompile.

Hello Jacob,

Thanks for replying.

we are getting

ERROR com.xx.xxx.xxxx - Unable to load JNI BBBController
Library java.lang.UnsatisfiedLinkError: /opt/XXXXX/lib/libjnixxx.so:
Can't load IA 32-bit .so on a IA 32-bit platform at

it is an Error message, which causes application running on TOMCAT to
stop.

Aqura

[toc] | [prev] | [next] | [standalone]


#9974

Fromjacob navia <jacob@spamsink.net>
Date2011-09-09 13:52 +0200
Message-ID<j4culf$gp$1@speranza.aioe.org>
In reply to#9970
Le 09/09/11 12:41, aqura a écrit :
>>
>> 3) What do you mean by "crashes at load time"? A segmentation fault
>>      or just an error message?
>>
>>      If it is an error message it is probably 100% a compiler version
>> issue. Restore your old compiler and recompile.
>
> Hello Jacob,
>
> Thanks for replying.
>
> we are getting
>
> ERROR com.xx.xxx.xxxx - Unable to load JNI BBBController
> Library java.lang.UnsatisfiedLinkError: /opt/XXXXX/lib/libjnixxx.so:
> Can't load IA 32-bit .so on a IA 32-bit platform at
>
> it is an Error message, which causes application running on TOMCAT to
> stop.


(1)
For System.loadLibrary() use the short name only, i.e. no path prefix
or dll extension, and make sure the file is in java.library.path or
your search PATH. For example:

System.loadLibrary("sampleDLL2");

For System.load(), specify the full path and filename. For example:
System.load("C:/sampleDLL2.dll");

Did you check those things?

[toc] | [prev] | [next] | [standalone]


#9978

Fromaqura <chandra.vikas21@gmail.com>
Date2011-09-09 05:50 -0700
Message-ID<3a9f627a-9623-4474-a29f-2bb8183a420f@t3g2000vbe.googlegroups.com>
In reply to#9974
On Sep 9, 4:52 pm, jacob navia <ja...@spamsink.net> wrote:
> Le 09/09/11 12:41, aqura a écrit :
>
>
>
>
>
>
>
>
>
>
>
> >> 3) What do you mean by "crashes at load time"? A segmentation fault
> >>      or just an error message?
>
> >>      If it is an error message it is probably 100% a compiler version
> >> issue. Restore your old compiler and recompile.
>
> > Hello Jacob,
>
> > Thanks for replying.
>
> > we are getting
>
> > ERROR com.xx.xxx.xxxx - Unable to load JNI BBBController
> > Library java.lang.UnsatisfiedLinkError: /opt/XXXXX/lib/libjnixxx.so:
> > Can't load IA 32-bit .so on a IA 32-bit platform at
>
> > it is an Error message, which causes application running on TOMCAT to
> > stop.
>
> (1)
> For System.loadLibrary() use the short name only, i.e. no path prefix
> or dll extension, and make sure the file is in java.library.path or
> your search PATH. For example:
>
> System.loadLibrary("sampleDLL2");
>
> For System.load(), specify the full path and filename. For example:
> System.load("C:/sampleDLL2.dll");
>
> Did you check those things?

Hi Jacob,

This is a existing source code, where everything was working fine.
the source code, we have taken from the repository and just build it,
without making any changes
and we see the crash.
if we leave the original binary, the server runs fine.

Aqura

[toc] | [prev] | [next] | [standalone]


#9980

FromEdek <edek.pienkowski@gmail.com>
Date2011-09-09 16:05 +0200
Message-ID<j4d6lg$mff$1@node2.news.atman.pl>
In reply to#9961
On 09/09/2011 10:44 AM, aqura wrote:
> We are facing an unusual problem, our JNI lib crashes at load time. we
> use CentOS 5.4/G++ and VS2005 for development.
>

[...]

> to pass on the result of our new enhancement.
>
[...]

> call(which we have added, as part of our new enhancement).
[...]

I just love the word 'enhancement' used in this
context.

>
> this is the error log we see
>
> AgentServer#0 started: OK 12750 [Connection#Cnx:#0.0.1026:0 -
> Session#c0s1] ERROR com.xx.xxx.xxxx - Unable to load JNI BBBController
> Library java.lang.UnsatisfiedLinkError: /opt/XXXXX/lib/libjnixxx.so:
> Can't load IA 32-bit .so on a IA 32-bit platform at
> java.lang.ClassLoader$NativeLibrary.load(Native Method) at
> java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751) at
> java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676) at
> java.lang.Runtime.loadLibrary0(Runtime.java:822) at
> java.lang.System.loadLibrary(System.java:993)

- ldd the lib in question, with same path as Java does it
- make sure there is no uncaught exception
- make sure you compile against the right headers
- google
- try getting obtaining the same result with a simple test,
things to try are countless (exception, unclean build (Makefiles),
JNI API misuse, .so depended on another DSO together with placing
them on different paths and with different -Djava.library.path
settings, DSO with unresolved symbols like using newer another DSO's
headers than the other DSO itself, using relative paths, or absolute
paths, full lib name, or just a short name, checking -rpaths and
sonames, and the list goes on)

HTH

Edek

[toc] | [prev] | [next] | [standalone]


#9982

Fromjacob navia <jacob@spamsink.net>
Date2011-09-09 16:22 +0200
Message-ID<j4d7eu$mmt$2@speranza.aioe.org>
In reply to#9980
Le 09/09/11 16:05, Edek a écrit :
  - ldd the lib in question, with same path as Java does it
> - make sure there is no uncaught exception
> - make sure you compile against the right headers
> - google
> - try getting obtaining the same result with a simple test,
> things to try are countless (exception, unclean build (Makefiles),
> JNI API misuse, .so depended on another DSO together with placing
> them on different paths and with different -Djava.library.path
> settings, DSO with unresolved symbols like using newer another DSO's
> headers than the other DSO itself, using relative paths, or absolute
> paths, full lib name, or just a short name, checking -rpaths and
> sonames, and the list goes on)
>
> HTH
>
> Edek
>

Yes, the list is endless. I thinkthat has to be done by an expert
at their site. Hint: I am not that expert, this looks like those
nightmarish problems to solve to me :-)

[toc] | [prev] | [next] | [standalone]


#9985

FromVictor Bazarov <v.bazarov@comcast.invalid>
Date2011-09-09 10:39 -0400
Message-ID<j4d8ei$7rd$1@dont-email.me>
In reply to#9961
On 9/9/2011 4:44 AM, aqura wrote:
> We are facing an unusual problem, our JNI lib crashes at load time. we
> use CentOS 5.4/G++ and VS2005 for development.
> [..]
> this is the error log we see
>
> AgentServer#0 started: OK 12750 [Connection#Cnx:#0.0.1026:0 -
> Session#c0s1] ERROR com.xx.xxx.xxxx - Unable to load JNI BBBController
> Library java.lang.UnsatisfiedLinkError: /opt/XXXXX/lib/libjnixxx.so:
> Can't load IA 32-bit .so on a IA 32-bit platform at
> java.lang.ClassLoader$NativeLibrary.load(Native Method) at
> java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751) at
> java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676) at
> java.lang.Runtime.loadLibrary0(Runtime.java:822) at
> java.lang.System.loadLibrary(System.java:993)
>
> Please suggest, any idea's would be appreciated.

Try asking in 'gnu.g++.help' newsgroup.  Java newsgroup might be useful 
as well.  Seems like your question really not about the C++ *language*, 
is it?

V
-- 
I do not respond to top-posted replies, please don't ask

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web