debugging SIGSEV on pclose

jojelino jojelino@gmail.com
Thu Sep 8 00:44:00 GMT 2011


On 2011-09-05 PM 11:01, Marco atzeri wrote:
> Hi jojelino,
> gs is unlikely crashing as the fltk.png is correctly produced.
>  From strace I know that octave crashes before gs complete its output.
>
i'm sorry. mine was not the case.
and after some digging, it is found that fd[6] is *closed* before pclose.

warning: print.m: epstool binary is not available.
Some output formats are not available.
Hardware watchpoint 3: cygheap->fdtab.fds[6]

Old value = (fhandler_base *) 0x0
New value = (fhandler_pipe *) 0x612dbb8c
_pipe (filedes=0x22b370, psize=0x10000, mode=0x10000)
     at /tmp/winsup/winsup/cygwin/pipe.cc:382
382           filedes[0] = fdin;
(gdb) b _sigfe_fclose
Breakpoint 6 at 0x610f080b
(gdb) c
Continuing.
[New Thread 1684.0xf98]

Breakpoint 6, 0x610f080b in _sigfe_fclose ()
    from /cygdrive/d/cygwin/bin/cygwin1.dll
(gdb) bt
#0  0x610f080b in _sigfe_fclose () from /cygdrive/d/cygwin/bin/cygwin1.dll
#1  0x66f6a41f in 
cygoctinterp-0!_ZN13glps_renderer4drawERK15graphics_object ()
    from /cygdrive/d/cygwin/bin/cygoctinterp-0.dll
#2  0x6ec0ff2f in _init_fltk__-0!_ZN11OpenGL_fltk4drawEv ()
    from D:/cygwin/lib/octave/3.4.2/oct/i686-pc-cygwin/__init_fltk__.oct
#3  0x6dab19ef in cygfltk_gl-1!_ZN12Fl_Gl_Window5flushEv ()
    from /cygdrive/d/cygwin/bin/cygfltk_gl-1.1.dll
#4  0x6dae2a0f in cygfltk-1!_ZN2Fl5flushEv ()
    from /cygdrive/d/cygwin/bin/cygfltk-1.1.dll
#5  0x6dae2c28 in cygfltk-1!_ZN2Fl4waitEd ()
    from /cygdrive/d/cygwin/bin/cygfltk-1.1.dll
#6  0x6ec21272 in 
_init_fltk__-0!_ZNK21fltk_graphics_toolkit12print_figureERK15graphics_objectRKSsS4_bS4_ 
()
    from D:/cygwin/lib/octave/3.4.2/oct/i686-pc-cygwin/__init_fltk__.oct
#7  0x66ffc52b in cygoctinterp-0!_Z8FdrawnowRK17octave_value_listi ()
    from /cygdrive/d/cygwin/bin/cygoctinterp-0.dll
#8  0x67159266 in 
cygoctinterp-0!_ZN14octave_builtin17do_multi_index_opEiRK17octave_value_listPKSt4listI13octave_lvalueSaIS4_EE 
()
    from /cygdrive/d/cygwin/bin/cygoctinterp-0.dll
#9  0x67158397 in 
cygoctinterp-0!_ZN14octave_builtin7subsrefERKSsRKSt4listI17octave_value_listSaIS3_EEiPKS2_I13octave_lvalueSaIS8_EE 
()
    from /cygdrive/d/cygwin/bin/cygoctinterp-0.dll
#10 0x67159066 in 
cygoctinterp-0!_ZN14octave_builtin7subsrefERKSsRKSt4listI17oct---Type 
<return> to continue, or q <return> to quit---q
Quit
(gdb)

i think fltk have bad behavior which use fclose to close pipe fd, but it 
should have used pclose. so closing disposed fd yields sigsegv.
http://pubs.opengroup.org/onlinepubs/009695399/functions/pclose.html
we should inspect fltk's glps_renderer::draw(graphics_object const&) for 
this strange behavior.


--
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