CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
segmentation fault (core dumped) error



May 7, 2014, 2:26 PM

Post #1 of 9 (4874 views)
segmentation fault (core dumped) error Can't Post

Hello everyone!!
This is my first post on here & I'm definitely a perl newbie. The following script is not my own & was written by a perl developer here at my work where I am a Linux SA.

The script when run on our Centos 6 i386 server runs successfully. When run on 64-bit however it fails with the error "Segmentation Fault (Core Dumped)" Both have same versions of XS::COMMON::DBCrypt, and same versions of perl etc..

I attempted to use the perl debugger but wasn't able to get any useful info running it step by step but then again I don't know much about perl.

Here is the script. Below are the last couple lines before it failed in perl debugger. Thank you for any help.


use strict;
use warnings;
use lib 'site/lib';
use COMMON::DBCrypt;

my $value = '0001RJ8504r_KOCJYhOfhta(rs>FWs!Q412er*4zT2PCZ33&V)';
my $decvalue;
eval { $decvalue = &COMMON::DBCrypt::ffndecrypt( $value ); };
print "$decvalue\n";

debug output

DB<1> s
209: return $mess;
DB<1> s
Signal SEGV at ./tim3 line 10
eval {...} called at ./tim3 line 10
Aborted (core dumped)


May 7, 2014, 2:50 PM

Post #2 of 9 (4862 views)
Re: [WhyNotKeithberg] segmentation fault (core dumped) error [In reply to] Can't Post

Also and I forgot to put this in. It say "core dumped" but I can't find the file. Not in the directory the perl script is, not in the /root directory, not in the CWD, not in /tmp. Not sure where else to look.

Veteran / Moderator

May 7, 2014, 2:53 PM

Post #3 of 9 (4860 views)
Re: [WhyNotKeithberg] segmentation fault (core dumped) error [In reply to] Can't Post

What version of perl are you using i.e., what's the output of this command from each system?
perl -v
perl -V (which provides more detailed info)

You say that both systems have the same version of XS::COMMON::DBCrypt, but your script is loading COMMON::DBCrypt. Which do you need to load?

Why are you calling the function in an eval block?

I don't find a module on cpan by either of those names, so is it a module written by your co-worker?

Could it be that the module requires one or more dependencies that are missing from the 64bit system?


May 7, 2014, 2:57 PM

Post #4 of 9 (4855 views)
Re: [FishMonger] segmentation fault (core dumped) error [In reply to] Can't Post

Those are very good questions and actually I was starting to wonder the same thing about the module. I will have to ask him if that was custom made. The RPM's that installed it are marked as i386 & x86_64 but that doesn't mean they didn't just rename a package to look better in the private repo.

As for perl versions I had checked before posting to see if any version differences and they're both running v5.10.1

As for the rest of the questions again I thank you for bringing them up and since I start my day at 6AM I need to head out but will have the answers tomorrow. As I said I didn't write the script or the module so I don't know much about it. All though I did find it weird with the eval block as well.

Appreciate the reply.

(This post was edited by WhyNotKeithberg on May 7, 2014, 2:59 PM)

Veteran / Moderator

May 8, 2014, 7:47 AM

Post #5 of 9 (4507 views)
Re: [WhyNotKeithberg] segmentation fault (core dumped) error [In reply to] Can't Post

There are a couple other things that you need to look into and verify.

Is perl issuing the segmentation fault, or is it coming from an external resource that the module calls?

Was perl built/compiled with debugging enabled? You can check that via perl -V. Normally it isn't enabled. You need to specifically enable the debug compiler option in the build process to get extra debugging options. The downside to enabling debug is that it adds additional overhead i.e., you'll take a performance hit.


May 8, 2014, 7:52 AM

Post #6 of 9 (4504 views)
Re: [FishMonger] segmentation fault (core dumped) error [In reply to] Can't Post

Here is the output of my 'perl -V'

I'm still waiting to hear back from the developer. I have a feeling it could have something to do with what you pointed out about the possible custom module since it works on i386 but not x86_64.

[root@ii104-21 (puppet) (07:48:04) /filer/home/kshannon/scripts]# perl -V  
Summary of my perl5 (revision 5 version 10 subversion 1) configuration:

osname=linux, osvers=2.6.32-220.el6.x86_64, archname=x86_64-linux-thread-multi
uname='linux 2.6.32-220.el6.x86_64 #1 smp tue dec 6 19:48:22 gmt 2011 x86_64 x86_64 x86_64 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DDEBUGGING=-g -Dversion=5.10.1 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib64/perl5 -Dprivlib=/usr/share/perl5 -Darchlib=/usr/lib64/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Dvendorarch=/usr/lib64/perl5/vendor_perl -Dinc_version_list=5.10.0 -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustomize'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.4.7 20120313 (Red Hat 4.4.7-3)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -fstack-protector'
libpth=/usr/local/lib64 /lib64 /usr/lib64
libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=, so=so, useshrplib=true,
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'

Characteristics of this binary (from libperl):
Built under linux
Compiled at Apr 30 2013 12:24:05


May 8, 2014, 12:50 PM

Post #7 of 9 (4451 views)
Re: [WhyNotKeithberg] segmentation fault (core dumped) error [In reply to] Can't Post

Hello, I just wanted to let you know that we've discovered the problem is not with the script or the module but in the C code XS is calling in I guess.

I honestly can't give you a 100% accurate replay of what was said as I'm not a developer and really don't understand the inner workings of all that. I just know that the underlying issue was found & it is now out of ops hands as it is a developer issue to resolve.

Thank you for taking time to help me out.

Veteran / Moderator

May 8, 2014, 1:06 PM

Post #8 of 9 (4445 views)
Re: [WhyNotKeithberg] segmentation fault (core dumped) error [In reply to] Can't Post

It's good to hear that you/they were able to track down the problem and it's now out of your hands.

I'm usually not that lucky on that last part. I do ops and dev work so troubleshooting issues like that go from my left hand to my right hand. Or should I say from my ops hat to my dev hat? :/


May 8, 2014, 1:08 PM

Post #9 of 9 (4443 views)
Re: [FishMonger] segmentation fault (core dumped) error [In reply to] Can't Post

Haha yeh lucky me :). I used to do Windows/Linux/Network Engineering/Network Security. Now I just focus on Linux with slight amounts of net security. However, I've been working more on my dev stuff because with the proliferation of devops my poor coding skills are catching up with me. So I need to put on my dev hat more often these days.

Thanks again & take care!


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives