EPrints Technical Mailing List Archive

Message: #04796


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Re: Apache segfault


Richard,

I wrote my previous email in two different time-frames, and it seems that I didn't "link" my two parts correctly, so I'll have to clarify the following:

In the first part of my email I'm telling you to install apache from sources. In the second part though, I'm telling you to try an alternate way of starting apache which might work as a workaround. So, if you test the second part and it works, you won't have to apache from sources. You just have to tell us it worked and we'll try to see how to preload a library when apache starts in Ubuntu.

I hope I've made my self clearer this time...:)

PS. The path of the library used in the command starting with LD_PRELOAD should be the one that you found when you ran "ldd /usr/lib/apache2/modules/mod_perl.so | grep -i expat" in your machine

On 25/09/2015 03:26 μμ, George Mamalakis wrote:
Hmm, OK,

I read the site behind the link a bit more carefully and it seems that this is your problem indeed. You can verify it by checking the apache2 and mod_perl binaries and see if they're both linked with expat. Eg, run:

# ldd /usr/bin/apache2 | grep -i expat
# ldd /usr/lib/apache2/modules/mod_perl.so | grep -i expat

and you should only see only one of them returning a link with the expat library. If both return it, then it seems that this is your case indeed.

In that case, you'll have to build apache from source if you want to collocate apache and XML::Parser for perl. There's this guide for building apache2.4 for Ubuntu (!!not 2.2!!), but from what I see all apache dependencies are installed (as it says) from apache2 package, so there might be a problem with linking to libexpat as well (http://phpboyscout.uk/compiling-apache-2-4-ubuntu-12-04/). On the other hand, linking is mainly performed based on what the configure script instructs, so at that point you should probably remove some of it's flags that cause this linkage, but I'm not sure which. But I'm not sure where the problem comes from: should apache be built without expat support or mod_perl? Because this is not clear from the wiki

I've done a small research with problems related to apache and lib-expat and in another situation (which seems very similar) that involved apache and mod_wsgi the problem was that the two installed expat libraries had different versions that caused apache to crash (because it was calling some library function with a different prototype, most probably). You can check each expat version by running something like:

# strings /path/to/your/libexpat/binary | grep expat_

and you'll most probably find out that the versions differ. The solution would be for both binaries to use the same expat library, which theoretically can be achieved by LD_PRELOAD, so maybe you could start the apache binary from command line using something like:

# LD_PRELOAD=/path/to/mod_perls/expat/library /usr/sbin/apachectl start

In that case it may work...but this means that you cannot start or stop apache using Ubuntu's startup scripts, except if Ubuntu has a way of telling which libraries should be preloaded before executing the apache binary (which is way out of my knowledge, since I'm mostly a BSD guy).

I'm not sure if I helped...:)

On 25/09/2015 02:07 μμ, George Mamalakis wrote:
OK,

First of all try to remove the two plugins one at a time and in the meantime start apache to see which one breaks apache.

Building apache from sources is not very dramatic, you just have to find an "easy guide". I'll search later to see if I find any and I will come back with the link. Do you run any other sites through the same apache (which may use PHP, python or any other server side language)?

In order to check a binary's linked libraries you can do so using the ldd command followed by the full path of the binary. In my system (Debian), running ldd on the apache2 binary returns:

# ldd /usr/sbin/apache2
.    linux-vdso.so.1 (0x00007fff8bce5000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f6c588ad000)
    libaprutil-1.so.0 => /usr/lib/x86_64-linux-gnu/libaprutil-1.so.0 (0x00007f6c58684000)
    libapr-1.so.0 => /usr/lib/x86_64-linux-gnu/libapr-1.so.0 (0x00007f6c5844e000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6c58231000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6c57e88000)
    libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f6c57c82000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f6c57a7a000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f6c57843000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6c5763e000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f6c57415000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f6c58dc9000)

Moreover, to see how many versions of a library are installed in your system you can use ldconfig with the -p option. So for example in the same system:
# ldconfig -p | grep -i expat
    libexpatw.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libexpatw.so.1
    libexpatw.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libexpatw.so
    libexpat.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libexpat.so.1
    libexpat.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libexpat.so

Using dpkg-query in a debian-based system (like Ubuntu), you can see which file is installed by which package, so in my system again:

# dpkg-query  -S /usr/lib/x86_64-linux-gnu/libexpatw.so
libexpat1-dev:amd64: /usr/lib/x86_64-linux-gnu/libexpatw.so

I see that libexpat1-dev package installed the library of libexpatw in it.

Maybe you can use these commands in your system to see what's wrong.

On 25/09/2015 01:01 μμ, Richard Jones wrote:
Hi George,
 

It would be good if you could provide the relevant apache logs. Moreover, if you uninstall the packages you mentioned you installed yesterday, does apache work OK?

I haven't tried yet, but I would expect so - it broke the instant I installed them!  I may back them out to confirm, but I need them installed for the XSLT import plugins to work.
 
In the link you provided it's talking about the expat library and I'm not sure the packages you've mentioned are related to that.

I'm not totally clear either, but they're both XML related, so seemed like a reasonable bet.
 
Nonetheless, what the link implies as a solution (IF this is your problem), is to install apache through sources so as to remove the double-linking with lib-expat.  

Hm, that's what I was afraid of :)  I'm not sure how to do that, or what it means to "remove the double-linking", so I'm hesitant to go down that route just yet.

Cheers,

Richard

 
 

George.


On 25/09/2015 12:03 μμ, Richard Jones wrote:
Hi Folks,

I think that I'm experiencing this error:

http://wiki.eprints.org/w/Troubleshooting#Apache_Crashes_with_a_segmentation_fault

Yesterday I installed libxml-libxml-perl and libxml-libxslt-perl to fix a problem with XSLT crosswalks not being loaded, and now I'm unable to restart apache.

I installed apache2 on my ubuntu system via the aptitude (so, not from source), and I installed eprints from source and manually installed the dependencies via aptitude.

The troubleshooting guide tells me what the problem might be, but doesn't have a fix - does anyone know how to resolve?

Cheers,

Richard

--

Richard Jones, 

Founder, Cottage Labs 
t: @richard_d_jones, @cottagelabs


*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/


-- 
George Mamalakis

IT and Security Officer, 
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/




--

Richard Jones, 

Founder, Cottage Labs 
t: @richard_d_jones, @cottagelabs


*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/


-- 
George Mamalakis

IT and Security Officer, 
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379




*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/


-- 
George Mamalakis

IT and Security Officer, 
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379




*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/


-- 
George Mamalakis

IT and Security Officer, 
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379