Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Segmentation fault in DBI + XML::LibXML

by furagu (Initiate)
on Feb 05, 2012 at 17:39 UTC ( #951963=note: print w/replies, xml ) Need Help??

in reply to Segmentation fault in DBI + XML::LibXML

Finally I got the solution.

Following advice from mje I ran the script in debugger and got this trace:

#0 0x000000080283d92d in pthread_mutex_destroy () from /lib/ +.3 #1 0x0000000801a15a15 in xmlFreeMutex () from /usr/local/lib/libxml2. +so.5 #2 0x0000000801a15455 in xmlCleanupGlobals () from /usr/local/lib/lib #3 0x00000008019ade8a in xmlCleanupParser () from /usr/local/lib/libx #4 0x000000080184edb3 in XS_XML__LibXML_END () from /usr/local/lib/pe +rl5/site_perl/5.10.1/mach/auto/XML/LibXML/ #5 0x00000008006df1f4 in Perl_pp_entersub () from /usr/local/lib/perl +5/5.10.1/mach/CORE/ #6 0x000000080068c0b0 in Perl_call_sv () from /usr/local/lib/perl5/5. +10.1/mach/CORE/ #7 0x000000080068c3c3 in Perl_call_list () from /usr/local/lib/perl5/ +5.10.1/mach/CORE/ #8 0x000000080068fe5f in perl_destruct () from /usr/local/lib/perl5/5 +.10.1/mach/CORE/ #9 0x0000000000400bcc in main ()

Seems like the problem is related to a thread support (this is also stated in the article posted by perl514).

Postgresql-client library has a thread safety turned on by default, so it took me some time to get it built without thread safety support, and that worked.

I don't think this is a really good solution though because thread safety can be usefull, and the best way would be to fix the libxml. But my scripts do not use threads, so I'm safe :)

Here are some short instructions how to rebuild postgresql-client without thread safety for those who's having the same problem.

First, configure postgresql-client port to get config.log file created:

cd /usr/ports/databases/postgresql84-client/; make configure

Second, extract configure options set by ports system:

cd work/postgresql-8.4.10/; grep ./configure config.log

There'll be something like this:

./configure --with-libraries=/usr/local/lib --with-includes=/usr/local/include --enable-thread-safety --with-openssl --with-libxml --enable-integer-datetimes --enable-nls --without-gssapi --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/ --build=amd64-portbld-freebsd8.2

Remove '--enable-thread-safety' from configure command line and run it in the current dir.

After the library is configured, build and reinstall it the usual way:

cd ../../; make FORCE_PKG_REGISTER=1 reinstall clean

That's all, now the postgresql-client has no thread safety.

Thanks to perl514, mje and Anonymous Monk for suggestions!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://951963]
[marto]: thanks

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2018-06-25 10:00 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.