Project

Profile

Help

Bug #2222

libsaxon error saxon/c on centos 7

Added by aytunc sevren over 5 years ago. Updated over 4 years ago.

Status:
In Progress
Priority:
High
Category:
PHP API
Start date:
2014-11-15
Due date:
% Done:

0%

Estimated time:
Found in version:
0.3.1
Fixed in version:

Description

Hi,

install saxon/c on centos 7 but restart the apache service httpd i get this error:

Nov 15 11:50:01 kernel: php[4045]: segfault at c1a176 ip 0000000000c1a176 sp 00007fff767f92c8 error 14 in libsaxon.so[7f8492288000+1000]

Nov 15 11:50:01 kernel: php[4046]: segfault at c1a176 ip 0000000000c1a176 sp 00007fff40503358 error 14 in libsaxon.so[7fd0ce365000+1000]

jet_err_19498.txt (19.5 KB) jet_err_19498.txt James Z.E., 2015-03-05 23:41
centos7setup.txt (3.2 KB) centos7setup.txt Eirik Hanssen, 2015-11-25 09:10

History

#1 Updated by O'Neil Delpratt over 5 years ago

  • Found in version set to 0.3.1

Please state the version of PHP you are installing saxon/c on and if you are using a 32-bit or 64-bit machine.

#2 Updated by aytunc sevren over 5 years ago

64-bit machine and php 5.4

#3 Updated by O'Neil Delpratt over 5 years ago

Hi, I am still trying to reproduce the seg error under centos 64-bit. Do you have any log file generated from the error either in the php log folder on where the libsaxon.so lives?

The following page might help: http://forums.cpanel.net/f5/php-segfault-problem-205902.html#post845372

#4 Updated by aytunc sevren over 5 years ago

Hi, I've had to format the server, so that I do not send you the log files.

#5 Updated by aytunc sevren over 5 years ago

Did you install saxon/c successfully on centos 7 64-bit machine?

#6 Updated by O'Neil Delpratt over 5 years ago

Hi, so far I did manage to compile and install saxon\c with the PHP extension on a vm centos 64-bit.

The bit that was tricky was the locating of the jni.h file. I had to install java-jdk then add the classpath to the file. Without this jni step the compilation fails with a lot of errors.

I am now getting libsaxon.so not found when I try to run with a PHP script example which uses the saxon\c API. I will investigate this today.

#7 Updated by O'Neil Delpratt over 5 years ago

Update on progress:

I thought I would share my experience on installing Saxon/C on centos 7 (64-bt machine) in hope it might help you to solve the set error.

Firstly, I had to copy the rt and the saxon-data directory along with the libsaxon.so library to the directory /usr/lib64 instead of the directory /usr/lib. I have fixed this instruction on the website.

Secondly, you should try to compile and run the C++ API. This can be done as follows:

g++ -g -o SaxonProcessor SaxonProcessor.cpp -ldl -lsaxon -lstdc++ -DCPP_ONLY
./SaxonProcessor

AS mentioned in comment 6: The compilation depends on Java headers otherwise you get an error with the jni.h not found:

CPLUS_INCLUDE_PATH=/usr/lib/rt/amd64:$JAVA_HOME/include/linux:$JAVA_HOME/include
export CPLUS_INCLUDE_PATH

Thirdly, I had to do the following to solve the error 'libjvm.so cannot open shared object file':

ln -s  /usr/lib64/rt/lib/amd64/jetjvm/libjvm.so /lib/libjvm.so

At this point the C++ program should run.

#8 Updated by James Z.E. over 5 years ago

aytunc sevren wrote:

Hi,

install saxon/c on centos 7 but restart the apache service httpd i get this error:

Nov 15 11:50:01 kernel: php[4045]: segfault at c1a176 ip 0000000000c1a176 sp 00007fff767f92c8 error 14 in libsaxon.so[7f8492288000+1000]

Nov 15 11:50:01 kernel: php[4046]: segfault at c1a176 ip 0000000000c1a176 sp 00007fff40503358 error 14 in libsaxon.so[7fd0ce365000+1000]

Using Centos7-64 + php5.4 + Apache2.4 + openJDK 1.7 + Saxon HEC 3.1 ->>> I got this error:

kernel: httpd[19637]: segfault at c1a176 ip 0000000000c1a176 sp 00007fff10241a78 error 14 in libgcc_s-4.8.2-20140120.so.1[7f51c7841000+15000]

Then I used this command:

g++ -g -o SaxonProcessor SaxonProcessor.cpp -ldl -lsaxon -lstdc++ -DCPP_ONLY

But I got a lot of error also... By the way, I've attached a file with these errors...

I hope you could give us some advice and thank in advanced :)

#9 Updated by O'Neil Delpratt over 5 years ago

  • Status changed from New to In Progress

Thanks for sending us the JET log file. We will investigate this further and report back shortly.

#10 Updated by O'Neil Delpratt over 5 years ago

Hi,

I reported the JET log file to Excelsior. Here is their response:

This is a crash inside GlibC library which may be caused by plenty of
various reasons (even bugs in Glibc itself).

Try to update libc library if it is
possible and check if the crash persists.

#11 Updated by O'Neil Delpratt over 5 years ago

Hi,

Following some correspondence with Excelsior Jet, we managed to get to the bottom of the segmentation fault, which was reported.

We think that the problem is indeed a bug in the test program of the Saxon/C code. It assumes that the test files are in the location: /var/www/trax

Summary from Jet:

We found that the crash happens because of JNI-misuse in the code you've provided.
 
So, if we don't have /var/www/trax directory in the system then the following happens:
 
1) C++ method XsltProcessor::xsltSaveResultToFile is called from main();
2) This method then calls XsltProcessor::xsltApplyStylesheet() which calls Java-method XsltProcessorForCpp.xsltApplyStylesheet() via JNI;
3) XsltProcessorForCpp.xsltApplyStylesheet() throws an exception which is not handled in C++ code and NULL is returned by this JNI call;
4) As the result XsltProcessor::xsltApplyStylesheet() also returns NULL;
5) Then XsltProcessor::xsltSaveResultToFile() takes the returned value (NULL) and calls fputs() C-function with this value as a parameter;
6) fputs() calls strlen() using the provided parameter (NULL) causing segmentation fault;
7) JET runtime handles this segmentation fault creating the crash log.

The C++ and PHP interfaces should work fine.

A fix will be applied in the next release for the test program. As a workaround you should be able to to change the main method in SaxonProcessor.cpp to run the tests files from a location of your choice, by setting the current working directory using the method setcwd().

#12 Updated by Eirik Hanssen over 4 years ago

Hello,

here's another libsaxon.so problem on Centos7.

On Centos7 I get Saxon/C working with php in CLI but not through the webserver.

I have read that the next release of Saxon/C is coming soon, and I am eagerly anticipating.

Error message I get:

[root@centos7 saxon-c]# systemctl status httpd -a | grep saxon

nov. 25 08:29:16 centos7.vm httpd[1151]: Unable to load /usr/lib/libsaxon.so

nov. 25 08:29:16 centos7.vm httpd[1151]: /usr/lib/libsaxon.so doesn't contain public JNI_GetDefaultJavaVMInitArgs

Do you have the missing clue that might make it work on Centos7 in through the webserver?

I have also been able to build saxon.so and libsaxon.so (using Exelcior jet 11), however I have gotten segfault when trying to use those.

So I have instead used the shipped saxon.so and libsaxon.so and made sure that the right php version was installed.

I realized after trial and error, that it is not enough to use the same php api the module was built against (php5.5). Since the module is non thread safe, then php also has to be non thread safe.

And that means the webserver has to be non thread safe, or apache2-mpm-prefork, not apache2-mpm-worker on debian systems.

Note that I was able to run Saxon/C with php through the webserver on Debian7.9 by using php5.5 from dotdeb repo.

On Debian 8.2 the only way to install php5.5 is to compile it from source. Doing that I was able to get Saxon/C working with php through the webserver.

Summary:

Centos7 64bit

httpd -version

Server version: Apache/2.4.6 (CentOS)

PHP 5.5.30

I have managed to install Saxon/C

running php -m | grep saxon -i

Reports:

Saxon/C

And if I look at phpinfo() output, the Saxon/C section is there.

I am able to run a php script using Saxon/C from CLI just fine, but if I visit the same page using a browser I get no data.

The whole setup procedure I used for the Centos7 virtual machine with apache+php+Saxon/C is attached (104 lines including comments and blank lines).

Best regards,

Eirik Hanssen

Oslo and Akershus University College of Applied Sciences

#13 Updated by O'Neil Delpratt over 4 years ago

Hi Eirik,

Thanks for providing such a detailed step-by-step setup guide on Centos 7. I will look into this shortly.

#14 Updated by Eirik Hanssen over 4 years ago

Thank you for looking into this matter.

Do you have any new estimate on the next release of Saxon/C?

#15 Updated by O'Neil Delpratt over 4 years ago

Sorry no. Not setting any firm deadline yet. But we are getting close. Currently in testing phase and some refining of the API.

Please register to edit this issue

Also available in: Atom PDF