Perl bug causes segfaults with XML::Twig

I’ve been using XML::Twig to parse some massive amounts of XML text for a project at work. My script worked just fine on my Fedora 20 workstation, but threw a segfault when run on the target Red Hat Enterprise 6 server.

Turns out there’s a bug in versions of perl earlier that 5.15 that leads to the result I saw. The technical details are described under BUGS in the perldoc for the module.

A good discussion of the issue appears in the comments to Bug # 83059 from last January, but it seems to have been stumbled upon as early as 2011 (see this post on PerlMonks, for example).

The solution for now is for me to do an additional installation of perl using the latest version (5.18.x) on my server. Back in my Solaris 7/8 days I used to use either sunfreeware (which ironically is no longer free, mostly due to Oracle’s failure to continue the generous support that Sun once provided) or just compile from source.

On Linux I’ve also got a few choices. The easiest, installing ActiveState’s ActivePerl isn’t an option because this is a production server process and their license prohibits using the free Community Edition in production (I did try this out on a test system, and the script performed perfectly under the latest AS perl for Linux). There’s also Perlbrew, which installs a utility that’s supposed to facilitate installing and running multiple versions of perl in a user’s home directory. Unfortunately this didn’t install for me, although I tried both the installer-via-curl and cpan methods. My final choice was to download and compile from source, which is how I’m now proceeding (fortunately my production machines are almost identical at the binary level, so I’ll be able to reuse what I build on other systems).

This entry was posted in Development, System Administration, Systems Analysis on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).