This has been an ongoing problem for a project I worked on and I've just now 
found the solution.
http://markmail.org/message/vpfgx2vgjzl354qm

It's pretty once I realized that you needed to treat Inline::Java socket connections to it's JVM (shared-jvm mode) just like you would DB handles under mod_perl. So here's a patch to the documentation to help others who might have this same problem:

--
Michael Peters
Plus Three, LP

--- Java.pod.orig       2008-09-09 16:21:59.000000000 -0400
+++ Java.pod    2008-09-09 16:30:10.000000000 -0400
@@ -1046,7 +1046,28 @@
 
 See the BUGS AND DEFICIENCIES section if you have problems starting 
 the SHARED_JVM server under MOD_PERL.
-   Z<>
+
+=head2 Preloading and PerlChildInitHandler
+
+If you are loading Inline::Java during your server startup (common practice
+to increase shared memory and reduce run time) and you are using C<SHARED_JVM>
+then your Apache processes will all share the same socked connection to that 
JVM.
+This will result in garbled communication and strange errors (like "Can't 
receive packet from JVM", "Broken pipe", etc).
+
+To fix this you need to tell Apache that after each child process has forked 
they
+each need to create their own connections to the JVM. This is done during the 
C<ChildInit>
+stage.
+
+For Apache 1.3.x this could look like:
+
+   # in httpd.conf
+   PerlChildInitHandler MyProject::JavaReconnect
+
+And C<MyProject::JavaReconnect> could be as simple as this:
+
+   package MyProject::JavaReconnect;
+   sub handler($$) { Inline::Java::reconnect_JVM() }
+   1;
 
 
 =head1 BUGS AND DEFICIENCIES

Reply via email to