in reply to Segmentation fault during file open

A couple of things to try:

  1. run under strace to get some better clues and a look at the call stack.
  2. Find out if any libraries were upgraded in the meantime. Shouldn't break things, but sometimes...
If the module's been working, I doubt that it's suddenly begun passing around null pointers, Could you be handing it a bogus reference?

After Compline,
Zaxo

  • Comment on Re: Segmentation fault during file open

Replies are listed 'Best First'.
Re: (2) Segmentation fault during file open
by talexb (Chancellor) on Mar 05, 2002 at 23:39 UTC
    Cool .. never tried strace before. Here's the tail end of what I got:
    write(2, "print on closed filehandle main:"..., 94print on closed file +handle main::STDBUG at /usr/local/lib/site_perl/CGI/LogCarp.pm line 1 +516. ) = 94 fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 write(2, "[Tue Mar 5 18:35:43 2002] 1789"..., 129[Tue Mar 5 18:35:4 +3 2002] 17898 mgtemp.pl ERR: Use of uninitialized value at /home/fin +info/htdocs/perllib/dograph.pm line 622. ) = 129 fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 open("/var/MPL/tmp/dailyen/C/CYS04.gp", O_WRONLY|O_CREAT|O_TRUNC, 0666 + <unfinished ...> +++ killed by SIGSEGV +++
    I know about the undefined value and I've been meaning to fix it, but it occurs in all of the other symbols and it doesn't kill them. Why is the open unfinished?

    Maybe I'll go fix that 'undefined' problem and try this all again.

    --t. alex

    "There was supposed to be an earth-shattering kaboom!" --Marvin the Martian

Re: (2) Segmentation fault during file open
by talexb (Chancellor) on Mar 06, 2002 at 02:49 UTC
    OK, fixed the undefined value problem (someone else had commented out one of my lines of code). Now the tail end of the strace output is
    read(5, "\n2002-02-28\0050.020\0050.020\0050.020\0050."..., 92) = 92 read(5, "\\\0\0?", 4) = 4 read(5, "\n2002-03-05\0050.020\0050.020\0050.020\0050."..., 92) = 92 read(5, "\1\0\0@", 4) = 4 read(5, "\376", 1) = 1 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 write(9, "# dograph version 12:51 2 Novemb"..., 4002) = 4002 close(9) = 0 munmap(0x2aac0000, 4096) = 0 open("/var/MPL/tmp/dailyen/C/CYS04.gp", O_WRONLY|O_CREAT|O_TRUNC, 0666 + <unfinished ...> +++ killed by SIGSEGV +++
    Thoughts?

    Update at 2222: Also tried changing the unless to an open .. || return .. in the extremely unlikely event that that would make a difference. No dice.

    --t. alex

    "There was supposed to be an earth-shattering kaboom!" --Marvin the Martian

      That's coming from within the libc open call. If you have debugging libc installed, running under gdb may help. Perl should not be able to do this to the system.1 What is your libc, OS and their patchlevels? One recent Linux release "featured" an fs corruption bug, so maybe booting a known good kernel is called for. A bad sector or corrupt inode could do this, so I think ehdonhon's suggestion of a fsck is a good idea at this point.

      If you're not getting core dumps for gdb, you can try $SIG{SEGV} = sub{abort};. You will want the source of libc open() to know what names to look at.

      The filesystem theory really doesn't fit crashing on the same file each time. I am puzzled..

      1 Update: Overstated, withdrawn.

      After Compline,
      Zaxo

        I have
        887712 Mar 25 2001 /lib/libc-2.1.3.so
        in my /lib directory. We're running version Debian GNU/Linux 2.2.15.

        I remain puzzled.

        --t. alex

        "There was supposed to be an earth-shattering kaboom!" --Marvin the Martian