Web server aborts page loading
This issue was reported by Petr Žák:
Relates to the close method. When I called close() method on processor's instance, it raise PHP warning : XSLT2 PHP close.
If I tried to create other new instance of SaxonProcessor after calling close processor on instance I used before(eg in cycle - see php attachment), webserver aborts page loading. As PHP programmer, I would except some PHP error, not strange abort of request without any message. If is required to use SaxonProcessor as singleton, so call only once initialization and only once close method, as PHP programmer I would except that this class is singleton by design - as singleton provided from PHP module.
#2 Updated by O'Neil Delpratt over 7 years ago
php warning "XSLT2 PHP close" that is raised by calling close() method needs removing.
Advise from user:
About recreating instance, maybe you should write the processor class with private constructor and getInstance method() - as singleton design pattern, and private cleanup method that would be called in __destroy method(php magic method that is called when the object is unset, script is executed or memory is released)... Because many of PHP programmers create new instances in cycles and have many bad practices with coding.
#3 Updated by Jeroen Bobbeldijk about 7 years ago
I get this quite often (like 1/3 of the page requests), it seems to be worse on v0.3-prerelease.
I have my processor in a singleton, and ->close it in a __destroy.
It also seems to be worse when I do more than 1 transform in a page request.
I'm getting jet_err_*.txt files in my webroot, but it doesn't contain a good error:
"JET RUNTIME HAS DETECTED UNRECOVERABLE ERROR: system exception at 0x0000000000000000"
Also, I think such errors should not break the site, a Java error should propagate to a PHP (fatal) error.
#5 Updated by Jeroen Bobbeldijk about 7 years ago
- File jet_err_6457.txt jet_err_6457.txt added
- File jet_err_6235.txt jet_err_6235.txt added
- File jet_err_3135.txt jet_err_3135.txt added
- File jet_err_2478.txt jet_err_2478.txt added
Sure, I attached four.
Are you sure this is in Jet? PHP CLI seems to work fine.
#6 Updated by O'Neil Delpratt about 7 years ago
- Status changed from In Progress to Resolved
Thanks to the help of Jeroen Bobbeldijk for providing the solution to this bug issue, which we now mark as resolved.
Made jvm and env static
Made proper check on jvmCreated so we only launch 1 jvm
Made close function static
Removed Close function from php object, now calls close on SaxonProcessor from MSHUTDOWN
Made all references to env and jvm to SaxonProcessor::env and SaxonProcessor::jvm
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.
For background details of the problem see the article:
Please register to edit this issue