Tom, could you please provide a chunk of java code with pure initialization?


2014-09-12 0:24 GMT+04:00 Daniel-Constantin Mierla <miconda@gmail.com>:
I can't help more with configuring and using app_java, because I am not using it. Maybe Konstantin can lead further.

If you get a core dump, then you can send the backtrace taken with gdb to see where the crash happened.

It is no longer the previous crash, which was a buffer overflow.

Cheers,
Daniel


On 11/09/14 21:26, Tom Johnson wrote:

Sorry, did not see that it was actual a fix to the crash.  Anyway, guess I’m having all sorts of issues with the app_java module.   If the –Djava.class.path is not the first parameter, the classpath does not appear to be set.  After switching to just one parameter, the “child_init” function appears to be called with all sorts of ranks and then Kamailio crashes.  My java code just logs it (using log4j) and returns 1.  Also, the log4j log only showed the -127 being called.

 

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15961]: INFO: app_java [java_mod.c:125]: mod_init(): Initializing Java VM with options: -Djava.class.path=/opt/microautomation/i3/I3Notifier.jar:/opt/kamailio/java/kamailio.jar:/opt/microautomation/i3/lib/log4j-1.2.16.jar

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15961]: INFO: app_java [java_mod.c:146]: mod_init(): app_java: Java VM initialization OK

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15961]: INFO: app_java [java_mod.c:198]: mod_init(): app_java: module initialization OK

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15961]: INFO: <core> [udp_server.c:176]: probe_max_receive_buffer(): INFO: udp_init: SO_RCVBUF is initially 124928

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15961]: INFO: <core> [udp_server.c:227]: probe_max_receive_buffer(): INFO: udp_init: SO_RCVBUF is finally 524288

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15961]: INFO: <core> [udp_server.c:176]: probe_max_receive_buffer(): INFO: udp_init: SO_RCVBUF is initially 124928

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15961]: INFO: <core> [udp_server.c:227]: probe_max_receive_buffer(): INFO: udp_init: SO_RCVBUF is finally 524288

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15961]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: -127

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15961]: INFO: app_java [java_mod.c:242]: child_init(): Child initialized, returning: 1

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15976]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: 1

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15977]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: 2

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15981]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: 4

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15984]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: 6

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15961]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: 0

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15986]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: 8

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15985]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: 7

Sep 11 15:17:07 MAIFREEPBX abrt[15994]: Can't open 'core.15981': Permission denied

Sep 11 15:17:07 MAIFREEPBX abrt[15997]: Can't open 'core.15976': Permission denied

Sep 11 15:17:07 MAIFREEPBX abrt[15996]: Can't open 'core.15977': Permission denied

Sep 11 15:17:07 MAIFREEPBX abrt[15996]: Not saving repeating crash in '/usr/local/sbin/kamailio'

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15988]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: -1

Sep 11 15:17:07 MAIFREEPBX abrt[15997]: Not saving repeating crash in '/usr/local/sbin/kamailio'

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15980]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: 3

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15983]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: 5

Sep 11 15:17:07 MAIFREEPBX abrt[16002]: Can't open 'core.15984': Permission denied

Sep 11 15:17:07 MAIFREEPBX abrt[16002]: Not saving repeating crash in '/usr/local/sbin/kamailio'

Sep 11 15:17:07 MAIFREEPBX abrt[16003]: Can't open 'core.15986': Permission denied

Sep 11 15:17:07 MAIFREEPBX abrt[16003]: Not saving repeating crash in '/usr/local/sbin/kamailio'

Sep 11 15:17:07 MAIFREEPBX abrt[16004]: Can't open 'core.15983': Permission denied

Sep 11 15:17:07 MAIFREEPBX abrt[16004]: Not saving repeating crash in '/usr/local/sbin/kamailio'

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15989]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: -1

Sep 11 15:17:07 MAIFREEPBX /usr/local/sbin/kamailio[15993]: INFO: app_java [java_mod.c:211]: child_init(): Initializing child with rank: -2

Sep 11 15:17:07 MAIFREEPBX abrt[16007]: Can't open 'core.15961': Permission denied

Sep 11 15:17:07 MAIFREEPBX abrt[16007]: Not saving repeating crash in '/usr/local/sbin/kamailio'

Sep 11 15:17:07 MAIFREEPBX kamailio: ERROR: <core> [daemonize.c:307]: daemonize(): Main process exited before writing to pipe

Sep 11 15:17:07 MAIFREEPBX abrt[16008]: Can't open 'core.15988': Permission denied

Sep 11 15:17:07 MAIFREEPBX abrt[16008]: Not saving repeating crash in '/usr/local/sbin/kamailio'

Sep 11 15:17:07 MAIFREEPBX abrt[16009]: Can't open 'core.15985': Permission denied

Sep 11 15:17:07 MAIFREEPBX abrt[16009]: Not saving repeating crash in '/usr/local/sbin/kamailio'

Sep 11 15:17:07 MAIFREEPBX abrt[16010]: Can't open 'core.15980': Permission denied

Sep 11 15:17:07 MAIFREEPBX abrt[16010]: Not saving repeating crash in '/usr/local/sbin/kamailio'

Sep 11 15:17:07 MAIFREEPBX abrt[16012]: Can't open 'core.15993': Permission denied

Sep 11 15:17:07 MAIFREEPBX abrt[16013]: Can't open 'core.15989': Permission denied

Sep 11 15:17:07 MAIFREEPBX abrt[16013]: Not saving repeating crash in '/usr/local/sbin/kamailio'

Sep 11 15:17:07 MAIFREEPBX abrt[16012]: Not saving repeating crash in '/usr/local/sbin/kamailio'

Sep 11 15:17:08 MAIFREEPBX abrt[15994]: Saved core dump of pid 15981 (/usr/local/sbin/kamailio) to /var/spool/abrt/ccpp-2014-09-11-15:17:07-15981 (152424448 bytes)

Sep 11 15:17:08 MAIFREEPBX abrtd: Directory 'ccpp-2014-09-11-15:17:07-15981' creation detected

Sep 11 15:17:40 MAIFREEPBX abrtd: Sending an email...

Sep 11 15:17:40 MAIFREEPBX abrtd: Email was sent to: root@localhost

Sep 11 15:17:41 MAIFREEPBX abrtd: New problem directory /var/spool/abrt/ccpp-2014-09-11-15:17:07-15981, processing

Sep 11 15:17:41 MAIFREEPBX abrtd: No actions are found for event 'notify'

 

From: Konstantin M. [mailto:evilzluk@gmail.com]
Sent: Thursday, September 11, 2014 3:04 PM
To: Tom Johnson
Cc: Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] app_java issue

 

Hello,

Please take a look to:
Sep 11 12:48:12 MAIFREEPBX /usr/local/sbin/kamailio[870]: ERROR: app_java [java_support.c:174]: handle_exception(): Exception:#012Exception in thread "main" java.lang.NoClassDefFoundError: KamailioPlugin#012    <<No stacktrace available>>Exception in thread "main" java.lang.ClassNotFoundException: KamailioPlugin#012    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)#012    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)#012    at java.security.AccessController.doPrivileged(Native Method)#012    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)#012    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)#012    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)#012    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)Exception in thread "main" java.lang.NoClassDefFoundError: KamailioPlugin#012    <<No stacktrace available>>Exception in thread "main" java.lang.ClassNotFoundException: KamailioPlugin#012    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)#012    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)#012    at java.security.AccessController.doPrivileged(Native Method)#012    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)#012    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)#012    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)#012    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Sep 11 12:48:12 MAIFREEPBX /usr/local/sbin/kamailio[870]: ERROR: <core> [sr_module.c:970]: init_mod(): init_mod(): Error while initializing module app_java (/usr/local/lib64/kamailio/modules/app_java.so)

To Daniel-Constantin, I didn't tested this yet but seems fine to me. Thank you for fix.

 


-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany