Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perl core dumps #663

Closed
p5pRT opened this issue Sep 30, 1999 · 8 comments
Closed

Perl core dumps #663

p5pRT opened this issue Sep 30, 1999 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 30, 1999

Migrated from rt.perl.org#1543 (status was 'resolved')

Searchable as RT1543$

@p5pRT
Copy link
Author

p5pRT commented Sep 30, 1999

From stavros@esc.net.au

I have a perl program which is core dumping. I've been told that if perl
core dumps then its it perl's fault.

Here are the details, please let me know if the probelm is mine or perl's​:

bang2# uname -a
FreeBSD bang2.esc.net.au 3.2-RELEASE FreeBSD 3.2-RELEASE #0​: Wed Aug 18
14​:32​:45 CST 1 999 stavros@​bang2.esc.net.au​:/usr/src/sys/compile/TEST
i386

bang2# perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration​:
  Platform​:
  osname=freebsd, osvers=4.0-current, archname=i386-freebsd
  uname='freebsd freefall.freebsd.org 4.0-current freebsd 4.0-current
#0​: $Date​: 199
9/05/05 19​:42​:40 $'
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=undef useperlio=undef d_sfio=undef
  Compiler​:
  cc='cc', optimize='undef', gccversion=egcs-2.91.66 19990314
(egcs-1.1.2 release)
  cppflags=''
  ccflags =''
  stdchar='char', d_stdstdio=undef, usevfork=true
  intsize=4, longsize=4, ptrsize=4, doublesize=8
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
  alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags ='-Wl,-E'
  libpth=/usr/lib
  libs=-lm -lc -lcrypt
  libc=/usr/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so.3
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
  cccdlflags='-DPIC -fpic', lddlflags='-shared'

Characteristics of this binary (from libperl)​:
  Built under freebsd
  Compiled at May 18 1999 02​:56​:17
  @​INC​:
  /usr/libdata/perl/5.00503/mach
  /usr/libdata/perl/5.00503
  /usr/local/lib/perl5/site_perl/5.005/i386-freebsd
  /usr/local/lib/perl5/site_perl/5.005
  .

Finally the script​:

bang2# cat make_headings.pl

#!/usr/local/bin/perl

use DB_File;

dbmopen(%all, "db/ALL", 0444);
dbmopen(%info, "info/INFO", 0655);

for ($i=1; $i < 2000000; $i++){
  $temp = $all{$i} ;
  $temp =~ s/.*HEADING​:(.*?)\n.*/$1/isg;
  $temp =~ s/\s|'|-|&|\/|,|\.//g;

  split (/\,/, $info{$temp});

  foreach $num (@​_){
  if ($num == $i){
  $NO = 1;
  }
  }

  if (! defined $NO){
  $info{$temp} .= "$i,";
  }
  undef $NO;

}

dbmclose(%info);
dbmclose(%all);

bang2# ./make_headings.pl
Bus error (core dumped)

The script is a really basic version of another more complicated script
that I was writing to perfom seraching over the db file. The keys are
numbers 1-2,000,000 (2million). The db file is about 1.5Gb on size,
however it occupies about 4.3Gb. I can send you a copy of the core dump
if you need it.

Regards,

Stavros Patiniotis


-System Administrator / Network Manager Escape.Net -
- 465b South Rd -
-email​: stavros@​esc.net.au Keswick SA 5035 -
-URL​: http​://www.esc.net.au Ph 82932526 Fax 82932949-


@p5pRT
Copy link
Author

p5pRT commented Sep 30, 1999

From [Unknown Contact. See original ticket]

On Fri, 01 Oct 1999 at 00​:45​:48 +0930, Stavros Patiniotis wrote​:

I have a perl program which is core dumping. I've been told that if perl
core dumps then its it perl's fault.

It's the fault of the program that's running​: in this case we have
Berkeley DB in the pot as well.

use DB_File;
dbmopen(%all, "db/ALL", 0444);
dbmopen(%info, "info/INFO", 0655);

It may be worth trying again, using tie/DB_File (dbmopen is a hangover from
perl 4, and is only really intended for use with NDBM or SDBM).

The script is a really basic version of another more complicated script
that I was writing to perfom seraching over the db file. The keys are
numbers 1-2,000,000 (2million). The db file is about 1.5Gb on size,
however it occupies about 4.3Gb. I can send you a copy of the core dump
if you need it.

A 'backtrace' from the core dump would be quite useful. Use 'gdb perl
core' and 'backtrace'

Also specify exactly which version of DB you're using. There are
core-dump issues with Berkeley DB (sorry, don't have details to hand).

Ian

@p5pRT
Copy link
Author

p5pRT commented Oct 1, 1999

From [Unknown Contact. See original ticket]

Ian Phillipps <ian@​dial.pipex.com> wrote

It may be worth trying again, using tie/DB_File (dbmopen is a hangover from
perl 4, and is only really intended for use with NDBM or SDBM).

Well, that's not quite what the man page says. It explicitly mentions
use with all the *DBM modules. And I doubt that trying with tie/DB_File
will make a difference (unless his default *DBM is something other
than DB_File :-), since dbmopen() is effectively just syntactic sugar for
the tie operation.

Mike Guy

@p5pRT
Copy link
Author

p5pRT commented Oct 1, 1999

From [Unknown Contact. See original ticket]

On Fri, 1 Oct 1999, M.J.T. Guy wrote​:

Ian Phillipps <ian@​dial.pipex.com> wrote

It may be worth trying again, using tie/DB_File (dbmopen is a hangover from
perl 4, and is only really intended for use with NDBM or SDBM).

Well, that's not quite what the man page says. It explicitly mentions
use with all the *DBM modules. And I doubt that trying with tie/DB_File
will make a difference (unless his default *DBM is something other
than DB_File :-), since dbmopen() is effectively just syntactic sugar for
the tie operation.

Well I tried the tie option, and it worked on the program that I sent to
this list, however it didn't work on all my other programs.

I'm not sure how to get the version of the DB files, so could someone
please let me know.

This is the error I'm getting now​:

./stats.pl
Bus error (core dumped)

I can include the script if you like? I'm not sure how to process the
core dump, so any info would be appreciated.

Thanks!

Regards,

Stavros Patiniotis


-System Administrator / Network Manager Escape.Net -
- 465b South Rd -
-email​: stavros@​esc.net.au Keswick SA 5035 -
-URL​: http​://www.esc.net.au Ph 82932526 Fax 82932949-


@p5pRT
Copy link
Author

p5pRT commented Oct 3, 1999

From [Unknown Contact. See original ticket]

On Fri, 01 Oct 1999 at 18​:34​:34 +0100, M.J.T. Guy wrote​:

Ian Phillipps <ian@​dial.pipex.com> wrote

It may be worth trying again, using tie/DB_File (dbmopen is a hangover from
perl 4, and is only really intended for use with NDBM or SDBM).

Well, that's not quite what the man page says. It explicitly mentions
use with all the *DBM modules. And I doubt that trying with tie/DB_File
will make a difference (unless his default *DBM is something other
than DB_File :-), since dbmopen() is effectively just syntactic sugar for
the tie operation.

Sorry, bad editing. I submitted three p5p postings last night, all of
them c--p. (Read the Date headers to see why :-)

It's GDBM that doesn't always fly with AnyDBM_File (and therefore
dbmopen), because of its different use of flags​: as discussed here a
while ago.

In particular, GDBM_WRCREATE == 2, whereas O_CREAT|O_RDWR == 66.

[Aside​: bug in SDBM_File documentation omits 'use Fcntl'. Try​:
  perl -e 'use SDBM_File; print O_RDWR|O_CREAT; print "\n";'
and see if you can work out the reason for what it prints...]

To Stavros​: if you have gdb (not gdbm!) then run
  gdb /your/path/to/perl core
and issue the
  backtrace
command. (Note that many BSDs have /usr/bin/perl and
/usr/local/bin/perl as quite different versions - get the right one!)

This should give an idea if the dump is occurring in perl itself or DB.
It's possible for DB to have passed perl a dud pointer, of course :-(
More useful stuff is inferrable if you compiled your perl, and
preferably the Berkeley DB, with a '-g' flag; fortunately GCC permits
this at the same time as optimisation.

Oh, and I don't think anyone's mentioned 'use sigtrap', either.
Now they have :-)

Ian
--
In theory, there's no difference between theory and practice.
In practice, there is.

@p5pRT
Copy link
Author

p5pRT commented Oct 4, 1999

From [Unknown Contact. See original ticket]

On Sat, 2 Oct 1999, Ian Phillipps wrote​:

To Stavros​: if you have gdb (not gdbm!) then run
gdb /your/path/to/perl core
and issue the
backtrace
command. (Note that many BSDs have /usr/bin/perl and
/usr/local/bin/perl as quite different versions - get the right one!)

They are both the same, 5.005_03.

This should give an idea if the dump is occurring in perl itself or DB.
It's possible for DB to have passed perl a dud pointer, of course :-(
More useful stuff is inferrable if you compiled your perl, and
preferably the Berkeley DB, with a '-g' flag; fortunately GCC permits
this at the same time as optimisation.

I have no idea!

Core was generated by `perl'.
Program terminated with signal 10, Bus error.
Reading symbols from /usr/lib/libperl.so.3...(no debugging symbols
found)...
done.
Reading symbols from /usr/lib/libm.so.2...(no debugging symbols
found)...done.
Reading symbols from /usr/lib/libcrypt.so.2...(no debugging symbols
found)...
done.
Reading symbols from /usr/lib/libc.so.3...(no debugging symbols
found)...done.
Reading symbols from /usr/libdata/perl/5.00503/mach/auto/Fcntl/Fcntl.so...
(no debugging symbols found)...done.
Reading symbols from
/usr/libdata/perl/5.00503/mach/auto/DB_File/DB_File.so...
done.
Reading symbols from /usr/libexec/ld-elf.so.1...done.
#0 0x2817703f in isatty () from /usr/lib/libc.so.3
(gdb) backtrace
#0 0x2817703f in isatty () from /usr/lib/libc.so.3
#1 0x2817732e in isatty () from /usr/lib/libc.so.3
#2 0x28177a3e in malloc () from /usr/lib/libc.so.3
#3 0x280b670a in Perl_safemalloc () from /usr/lib/libperl.so.3
#4 0x280a2e0e in Perl_sv_grow () from /usr/lib/libperl.so.3
#5 0x280a5169 in Perl_sv_setpvn () from /usr/lib/libperl.so.3
#6 0x2819a2c2 in XS_DB_File_NEXTKEY (cv=0x80c2ae8) at DB_File.xs​:1674
#7 0x280ae26d in Perl_pp_entersub () from /usr/lib/libperl.so.3
#8 0x280df836 in perl_call_sv () from /usr/lib/libperl.so.3
#9 0x280df3bf in perl_call_method () from /usr/lib/libperl.so.3
#10 0x280b469d in Perl_magic_nextpack () from /usr/lib/libperl.so.3
#11 0x280b1ffd in Perl_hv_iternext () from /usr/lib/libperl.so.3
#12 0x2809cad1 in Perl_pp_each () from /usr/lib/libperl.so.3
#13 0x28079c3d in Perl_runops_standard () from /usr/lib/libperl.so.3
#14 0x280df0be in perl_run () from /usr/lib/libperl.so.3
#15 0x8048da8 in perl_free ()
#16 0x8048cd5 in perl_free ()
(gdb)

I assumes that my postings should all be sent to this list, not to you in
private?

Oh, and I don't think anyone's mentioned 'use sigtrap', either.
Now they have :-)

?

Sorry but your dealing with a novice here.

tie %info, "DB_File", "info/INFO", (O_RDONLY), 0444;
tie %data, "DB_File", "db/ALL", (O_RDONLY), 0444;

#This line crashes it.
while (($key, $val) = each %info)

Regards,

Stavros Patiniotis


-System Administrator / Network Manager Escape.Net -
- 465b South Rd -
-email​: stavros@​esc.net.au Keswick SA 5035 -
-URL​: http​://www.esc.net.au Ph 82932526 Fax 82932949-


@p5pRT
Copy link
Author

p5pRT commented Oct 7, 1999

From [Unknown Contact. See original ticket]

On Tue, 05 Oct 1999 at 09​:36​:35 +0930, Stavros Patiniotis wrote​:

I assumes that my postings should all be sent to this list, not to you in
private?

Oh, and I don't think anyone's mentioned 'use sigtrap', either.
Now they have :-)

?

Sorry but your dealing with a novice here.

Well, the simplest case is that you include the phrase
  use sigtrap;
into your program. Easier than you thought, eh?
There are all sorts of extra features, but this gives perl-oriented
output for most SEGV or BUS traps.

You can say 'man sigtrap' or 'perldoc sigtrap' and get useful
information, too.

Ian

@p5pRT
Copy link
Author

p5pRT commented Oct 7, 1999

From [Unknown Contact. See original ticket]

Sorry but your dealing with a novice here.

Well, the simplest case is that you include the phrase
use sigtrap;
into your program. Easier than you thought, eh?
There are all sorts of extra features, but this gives perl-oriented
output for most SEGV or BUS traps.

You can say 'man sigtrap' or 'perldoc sigtrap' and get useful
information, too.

Ahh, so we are running out of memory! Too easy. I guess I should now
take this off to a different list to get over this problem- unless anyone
wants to suggest something I can do to get over this.

bang2# ./easy info/INFO
KEY VALUE
perl in malloc()​: warning​: recursive call.
Out of memory!
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in free()​: warning​: recursive call.
perl in malloc()​: warning​: recursive call.
Out of memory!
bang2#

Ian

Regards,

Stavros Patiniotis


-System Administrator / Network Manager Escape.Net -
- 465b South Rd -
-email​: stavros@​esc.net.au Keswick SA 5035 -
-URL​: http​://www.esc.net.au Ph 82932526 Fax 82932949-


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant