debugging SIGSEV on pclose

Marco atzeri marco.atzeri@gmail.com
Tue Sep 6 09:02:00 GMT 2011


On 9/6/2011 5:20 AM, jan.kolar wrote:
>
> Marco,
> this is not point where octave always crashes, since in an strace dump I
> sent you separately, I read
>    188 145419026 [main] octave-3.4.2 11704 close: close (6)
>    31 145419057 [main] octave-3.4.2 11704 fhandler_base::close: closing
> 'pipe:[6]'
>    34 145419091 [main] octave-3.4.2 11704 close: 0 = close (6)
> which I believe to be produced by
>       if (fclose (fp))
> just below the code you listed.
> Also you give two 'Program received signal SIGSEGV' with different
> locations.
>
> This suggests the problem is caused by an asynchronous event.
> The event may come from another thread, from OS, or from a child process.
>
> I suggest to replace gs with another program (like cat.exe with a
> redirection) and
> test if that makes difference.
>
Hi Kolar,
first please no top posting on the cygwin mailing list.

Stepping within GDB, I can confirm you that the crash is happening
inside pclose.
The close reported by strace is relative to the pclose call, and the
exception is killing octave not gs.
--------------------------------------------------------------------
   232 103746055 [main] octave-3.4.2 3664 close: close (6)
    33 103746088 [main] octave-3.4.2 3664 fhandler_base::close: closing 
'pipe:[6]' handle 0x470
    33 103746121 [main] octave-3.4.2 3664 close: 0 = close (6)

   205  258249 [main] gs 2840 open: open 
(/usr/share/ghostscript/8.63/lib/gs_wan_e.ps, 0x0)
    30  258279 [main] gs 2840 normalize_posix_path: src 
/usr/share/ghostscript/8.63/lib/gs_wan_e.ps
    30  258309 [main] gs 2840 normalize_posix_path: 
/usr/share/ghostscript/8.63/lib/gs_wan_e.ps = normalize_posix_path 
(/usr/share/ghostscript/8.63/lib/gs_wan_e.ps)
    27  258336 [main] gs 2840 mount_info::conv_to_win32_path: 
conv_to_win32_path (/usr/share/ghostscript/8.63/lib/gs_wan_e.ps)
    26  258362 [main] gs 2840 set_flags: flags: binary (0x2)
    33  258395 [main] gs 2840 mount_info::conv_to_win32_path: src_path 
/usr/share/ghostscript/8.63/lib/gs_wan_e.ps, dst 
E:\cygwin2\usr\share\ghostscript\8.63\lib\gs_wan_e.ps, flags 0x3000A, rc 0
    66  258461 [main] gs 2840 symlink_info::check: 0x0 = NtCreateFile 
(\??\E:\cygwin2\usr\share\ghostscript\8.63\lib\gs_wan_e.ps)
    43  258504 [main] gs 2840 symlink_info::check: not a symlink
--- Process 3664, exception C0000005 at 610ECEFA
[long cut]
39 2360323 [main] gs 2840 pinfo::exit: Calling ExitProcess n 0x0, 
exitcode 0x0
-----------------------------------------------------------------------

stepping inside pclose, line 4026 of syscalls.cc
is where the SIGSEV is generated, but why is the nasty question

-----------------------------------------------------------------------
[long cut]
4024      fhandler_pipe *fh = (fhandler_pipe *) cygheap->fdtab[fileno(fp)];
(gdb) step
4026      if (fh->get_device () != FH_PIPEW && fh->get_device () != 
FH_PIPER)
(gdb) step
0x7c90e480 in ntdll!LdrDisableThreadCalloutsForDll ()
    from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function 
ntdll!LdrDisableThreadCalloutsForDll,
which has no line number information.
0x7c92a824 in wcstol () from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function wcstol,
which has no line number information.
0x7c9033dc in ntdll!RtlCheckRegistryKey ()
    from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function ntdll!RtlCheckRegistryKey,
which has no line number information.
0x7c92a853 in wcstol () from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function wcstol,
which has no line number information.
0x7c9033f8 in ntdll!RtlCheckRegistryKey ()
    from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function ntdll!RtlCheckRegistryKey,
which has no line number information.
0x7c92a858 in wcstol () from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function wcstol,
which has no line number information.
0x7c901118 in ntdll!RtlUnhandledExceptionFilter ()
    from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function ntdll!RtlUnhandledExceptionFilter,
which has no line number information.
0x7c92a97b in wcstol () from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function wcstol,
which has no line number information.
0x7c92f557 in ntdll!_itow () from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function ntdll!_itow,
which has no line number information.
0x7c92aa01 in wcstol () from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function wcstol,
which has no line number information.
0x7c910339 in ntdll!RtlInitAnsiString ()
    from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function ntdll!RtlInitAnsiString,
which has no line number information.
0x7c9102d9 in ntdll!RtlAppendStringToString ()
    from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function ntdll!RtlAppendStringToString,
which has no line number information.
0x7c90e8cb in strchr () from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function strchr,
which has no line number information.
0x7c9102e5 in ntdll!RtlAppendStringToString ()
    from /cygdrive/c/WINDOWS/system32/ntdll.dll
(gdb) step
Single stepping until exit from function ntdll!RtlAppendStringToString,
which has no line number information.

Program received signal SIGSEGV, Segmentation fault.
0x7c90e514 in ntdll!LdrAccessResource ()
    from /cygdrive/c/WINDOWS/system32/ntdll.dll
-----------------------------------------------------------------------


Regards
Marco




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list