On 17 Jun 2014, at 14:37, O'Neil Delpratt <oneil@saxonica.com> wrote:

On 17 Jun 2014, at 09:18, Christian Schwaderer <c_schwaderer@hotmail.com> wrote:

I've now (almost) set up my XSLT 2 project and aside from the annoying crashes with the "JNI_CreateJavaVM() failed with result-5" errors* I'm quite content with Saxon/C, thinking this is the best Saxon integration for PHP programmers.

I am still investigating this, but according to the Java SE Platfrom specification, JNI_CreateJavaVM can be invoked at most once in each separate process. This error means that we are invoking it more than once.

Just to report back to the list that the bug issue relating to the error "JNI_CreateJavaVM() failed with result-5 has now been resolved. See: https://saxonica.plan.io/issues/2054

Thanks to Jeroen Bobbeldijk for working on this and providing the solution. I did some extensive test requests and the php script does not abort. Jeroen also reported that he did 500 requests with a concurrency of 5, no errors at all.

Background to the problem and solution:


The way it works now:
- Create a jvm on the first new SaxonProcessor() for this php runtime (possibly within Apache)
- Close the jvm on MSHUTDOWN (end of this specific php runtime, not request) .

This way the same jvm should be used over multiple requests, and the jvm should be stopped when the webserver/worker is stopped.

kind regards,
O'Neil Delpratt
Software Developer, Saxonica Limited Email: oneil@saxonica.com
Tel: +44 118 946 5894
Web: http://www.saxonica.com
Saxonica Community site: http://dev.saxonica.com
Bug tracking site: https://saxonica.plan.io/