dillo seems to close file descriptors twice
Hi, I just noticed, that dillo seems to close file descriptors twice via IO_close_fd, which causes problems when other threads run in parallel for name server queries. Here are the two call stacks via which IO_close_fd is called for each fd: (gdb) b IO_close_fd Breakpoint 1 at 0x8070781: file IO.c, line 137. (gdb) r dillo.org Starting program: /home/hofmann/projects/dillo/plain/dillo2-hg/src/dillo-fltk dillo.org dillo_dns_init: Here we go! (threaded) Enabling cookies as from cookiesrc... Nav_open_url: new url='http://dillo.org' Dns_server [0]: dillo.org is 0x28559680 Connecting to 134.102.206.165 Nav_open_url: new url='http://www.dillo.org/' Breakpoint 1, IO_close_fd (io=0x28550a00, CloseCode=2) at IO.c:137 137 fprintf(stderr,"====> begin IO close (%d)\n", io->FD); Current language: auto; currently c (gdb) bt #0 IO_close_fd (io=0x28550a00, CloseCode=2) at IO.c:137 #1 0x0807094e in a_IO_ccc (Op=4, Branch=1, Dir=2, Info=0x285509e0, Data1=0x0, Data2=0x0) at IO.c:392 #2 0x0805633e in a_Chain_bcb (Op=4, Info=0x28550a00, Data1=0x0, Data2=0x0) at chain.c:98 #3 0x0806ea14 in a_Http_ccc (Op=4, Branch=1, Dir=2, Info=0x2854df60, Data1=0x0, Data2=0x0) at http.c:522 #4 0x0805633e in a_Chain_bcb (Op=4, Info=0x28550a00, Data1=0x0, Data2=0x0) at chain.c:98 #5 0x0805a514 in a_Capi_ccc (Op=4, Branch=1, Dir=2, Info=0x2854df40, Data1=0x0, Data2=0x0) at capi.c:491 #6 0x0805a39c in a_Capi_ccc (Op=4, Branch=2, Dir=1, Info=0x285509a0, Data1=0x0, Data2=0x0) at capi.c:601 #7 0x0805630a in a_Chain_fcb (Op=4, Info=0x28550a00, Data1=0x0, Data2=0x0) at chain.c:86 #8 0x0806ffd1 in a_Dpi_ccc (Op=4, Branch=2, Dir=1, Info=0x28550bc0, Data1=0x0, Data2=0x0) at dpi.c:671 #9 0x0805630a in a_Chain_fcb (Op=4, Info=0x28550a00, Data1=0x0, Data2=0x0) at chain.c:86 #10 0x08070891 in a_IO_ccc (Op=4, Branch=2, Dir=1, Info=0x28550c00, Data1=0x28550c20, Data2=0x0) at IO.c :410 #11 0x08070b64 in IO_callback (fd=<value optimized out>, io=0x28550c20) at IO.c:201 #12 0x08070beb in IO_fd_read_cb (fd=7, data=0x2) at IO.c:277 #13 0x080bcfe5 in fltk::wait () #14 0x080bd195 in fltk::run () #15 0x0804eadb in main (argc=0, argv=0x0) at dillo.cc:110 (gdb) c Continuing. ====> begin IO close (7) Breakpoint 1, IO_close_fd (io=0x28550c20, CloseCode=2) at IO.c:137 137 fprintf(stderr,"====> begin IO close (%d)\n", io->FD); (gdb) bt #0 IO_close_fd (io=0x28550c20, CloseCode=2) at IO.c:137 #1 0x0807089e in a_IO_ccc (Op=4, Branch=2, Dir=1, Info=0x28550c00, Data1=0x28550c20, Data2=0x0) at IO.c:411 #2 0x08070b64 in IO_callback (fd=<value optimized out>, io=0x28550c20) at IO.c:201 #3 0x08070beb in IO_fd_read_cb (fd=7, data=0x2) at IO.c:277 #4 0x080bcfe5 in fltk::wait () #5 0x080bd195 in fltk::run () #6 0x0804eadb in main (argc=0, argv=0x0) at dillo.cc:110 (gdb) c Continuing. ====> begin IO close (7) A line like fprintf(stderr,"====> begin IO close (%d)\n", io->FD); at the beginning of IO_close_fd() also shows the problem. Cheers, Johannes
On Tue, Apr 22, 2008 at 08:27:39PM +0200, Johannes Hofmann wrote:
Hi,
I just noticed, that dillo seems to close file descriptors twice via IO_close_fd, which causes problems when other threads run in parallel for name server queries. Here are the two call stacks via which IO_close_fd is called for each fd:
OK, I committed a commented patch for this. Please test it. I'd be also interested to know whether this fixes the SIGPIPE problems you saw in your OS. I remember removing the ignore SIGPIPE code because it didn't happen anymore in GNU/Linux. It'd be good to know where it comes from. -- Cheers Jorge.-
Hi, On Tue, Apr 29, 2008 at 10:40:18AM -0400, Jorge Arellano Cid wrote:
On Tue, Apr 22, 2008 at 08:27:39PM +0200, Johannes Hofmann wrote:
Hi,
I just noticed, that dillo seems to close file descriptors twice via IO_close_fd, which causes problems when other threads run in parallel for name server queries. Here are the two call stacks via which IO_close_fd is called for each fd:
OK, I committed a commented patch for this. Please test it.
Yes, the double close problem is gone with this patch.
I'd be also interested to know whether this fixes the SIGPIPE problems you saw in your OS.
I remember removing the ignore SIGPIPE code because it didn't happen anymore in GNU/Linux. It'd be good to know where it comes from.
The SIGPIPE problem is still there: Program received signal SIGPIPE, Broken pipe. 0x283e1050 in write () from /usr/lib/libc.so.6 (gdb) bt #0 0x283e1050 in write () from /usr/lib/libc.so.6 #1 0x28297f2c in write () from /usr/lib/libpthread.so.0 #2 0x080712a2 in IO_callback (fd=<value optimized out>, io=0x282a18c0) at IO.c:226 #3 0x080713f7 in IO_fd_write_cb (fd=7, data=0x1) at IO.c:303 #4 0x080bd4b9 in fltk::wait () #5 0x080bd669 in fltk::run () #6 0x0804eadb in main (argc=Cannot access memory at address 0x0) at dillo.cc:110 The signal is delivered as dillo writes to a socket that has been closed by the remote side. I rather wonder, why this does not happen on Linux. I found this on the topic: http://www.developerweb.net/forum/showthread.php?t=2953 Cheers, Johannes
participants (3)
-
jcid@dillo.org
-
joerg.sonnenberger@web.de
-
Johannes.Hofmann@gmx.de