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.

 

2014-09-11 20:57 GMT+04:00 Tom Johnson <TJohnson@microautomation.com>:

Here is the log after the change.

 

From: Daniel-Constantin Mierla [mailto:miconda@gmail.com]
Sent: Thursday, September 11, 2014 11:55 AM
To: Kamailio (SER) - Users Mailing List; Tom Johnson; Konstantin M.
Subject: Re: [SR-Users] app_java issue

 

Can you try with the patch from next commit:

- http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=commitdiff;h=a13e3b46dba4470deb748eec3b700386f453f6f9;hp=74f53b7d7f6ff00144152aff453e6b388447320c

It has code indentation, as I needed to figure out the blocks there, effectively you have to change the line:

buf = (char **)pkg_realloc(buf, (i+1) * sizeof(char *));

in:

buf = (char **)pkg_realloc(buf, (i+2) * sizeof(char *));

inside the file modules/app_java/utils.c

I cc-ed Konstantin, the author of the module, to review the change.

Cheers,
Daniel

On 09/09/14 21:31, Tom Johnson wrote:

Per my previous message, I determined that the module’s makefile was not properly finding the jdk/jre directories needed to compile.   So, I temporarily hardcoded the paths in the makefile.

 

However, now when I use the module, Kamailio crashes.  Below is the lines from /var/log/messages:

 

Sep  9 15:13:10 MAIFREEPBX kamailio: INFO: <core> [tcp_main.c:4836]: init_tcp(): init_tcp: using epoll_lt as the io watch method (auto detected)

Sep  9 15:13:10 MAIFREEPBX kamailio: WARNING: <core> [daemonize.c:352]: daemonize(): pid file contains old pid, replacing pid

Sep  9 15:13:10 MAIFREEPBX /usr/local/sbin/kamailio[12268]: INFO: rr [../outbound/api.h:54]: ob_load_api(): Failed to import bind_ob

Sep  9 15:13:10 MAIFREEPBX /usr/local/sbin/kamailio[12268]: INFO: rr [rr_mod.c:159]: mod_init(): outbound module not available

Sep  9 15:13:10 MAIFREEPBX /usr/local/sbin/kamailio[12268]: INFO: usrloc [hslot.c:53]: ul_init_locks(): locks array size 512

Sep  9 15:13:10 MAIFREEPBX /usr/local/sbin/kamailio[12268]: INFO: auth [auth_mod.c:350]: mod_init(): auth: qop set, but nonce-count (nc_enabled) support disabled

Sep  9 15:13:10 MAIFREEPBX /usr/local/sbin/kamailio[12268]: INFO: app_java [java_mod.c:125]: mod_init(): Initializing Java VM with options: -Xdebug -verbose:gc,class,jni -Djava.compiler=NONE -Djava.class.path=/opt/microautomation/i3/I3Notifier.jar:/opt/kamailio/java/kamailio.jar:/opt/microautomation/i3/lib/log4j-1.2.16.jar

Sep  9 15:13:10 MAIFREEPBX /usr/local/sbin/kamailio[12268]: INFO: app_java [java_mod.c:146]: mod_init(): app_java: Java VM initialization OK

Sep  9 15:13:10 MAIFREEPBX /usr/local/sbin/kamailio[12268]: INFO: app_java [java_mod.c:198]: mod_init(): app_java: module initialization OK

Sep  9 15:13:10 MAIFREEPBX /usr/local/sbin/kamailio[12268]: : <core> [mem/q_malloc.c:159]: qm_debug_frag(): BUG: qm_*: prev. fragm. tail overwritten(0, abcdefed)[0x7f0941207190:0x7f09412071c0]!

Sep  9 15:13:11 MAIFREEPBX abrt[12282]: Saved core dump of pid 12268 (/usr/local/sbin/kamailio) to /var/spool/abrt/ccpp-2014-09-09-15:13:10-12268 (183721984 bytes)

 

The code dump mentioned does not exist.

 

If I do not load the app_java module, Kamailio works.

 

 

 

Tom Johnson |  Senior Software Engineer
O: 703-543-2118  |  F: 703-543-2099 
5870 Trinity Parkway, Suite 600, Centreville, VA  20120
cid:image001.png@01CE18AF.8F231EB0

 



_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

 

-- 
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