-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mohamedin,
On 10/7/2009 10:40 AM, Mohamedin wrote: > Dear all, > > I am trying to use a JNI library written by me that uses > GraphicsMagick wand. It is working fine as a stand alone java > application but when I tried to use it in tomcat it give me this error > and tomcat crashed. Technically speaking, the JVM has crashed, not Tomcat. > I am running on: > > AMD64 > Tomcat 6.0.20 > CATALINA_OPTS => "-server -Xms512m -Xmx2048m > -Djava.library.path=/usr/lib/apache-tomcat-6.0.20/shared/lib/:/usr/local/lib/" > > Please help > > *** glibc detected *** /usr/bin/java: malloc(): memory corruption: > 0x00007f5614455720 *** > ======= Backtrace: ========= > /lib/libc.so.6[0x7f56b0cc7948] > /lib/libc.so.6[0x7f56b0cca17c] > /lib/libc.so.6(__libc_malloc+0x98)[0x7f56b0ccba78] > /usr/lib/apache-tomcat-6.0.20/shared/lib/libPhotoOperations.so(NewMagickWand+0x13)[0x7f561b7068de] > /usr/lib/apache-tomcat-6.0.20/shared/lib/libPhotoOperations.so(reduce_quality_to+0x26)[0x7f561b6f71f6] > /usr/lib/apache-tomcat-6.0.20/shared/lib/libPhotoOperations.so(reduce_quality+0x88)[0x7f561b6f74e8] > /usr/lib/apache-tomcat-6.0.20/shared/lib/libPhotoOperations.so(Java_com_vehicle_netapp_backend_objects_photo_PhotoOperations_reduceQuality+0x68)[0x7f561b6f7688] > [0x7f56a95ca542] Since your code is definitely involved, here (the stack trace above shows 4 layers of your code before glibc is involved), I suspect your code is to blame for this problem. Tomcat does not use any native code directly (except for tcnative if you are using that). Are you using tcnative? If so, disable it and re-try to convince yourself that this is not a Tomcat problem. I'm not saying it is definitely /not/ a Tomcat problem, but chances are that it's your code at fault. My experience with native code from Java is that when memory corruption is found in one instance but not another and the code is the same, then there is probably some bug in your code that is sensitive to re-location of your code within memory. That is, you are making assumptions about your environment that are not valid when running from within a JVM (or they work sometimes, but not other times because more code gets loaded when running under an app server). How much of your JNI code are you willing to post? Typically, one develops a native library that has nothing to do with Java, and then writes a Java wrapper around that code which is little more than the plumbing necessary to convert data between Java-style objects, arrays, etc. and C-style data structures. Have you done that? If so, go ahead and post the JNI-specific layer. If not, I think you're playing with fire by writing a native library that does a great deal of Java interaction. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkrM4EcACgkQ9CaO5/Lv0PBregCgumcWoLGOm+fOjvV4S79ZHt1P y10AoKqWpMNgMMYKKubd9H+jQPKjIHS2 =rfQZ -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org