Bug 1740 - window "capture->Interfaces" cannot be closed
Summary: window "capture->Interfaces" cannot be closed
Status: RESOLVED FIXED
Alias: None
Product: Wireshark
Classification: Unclassified
Component: GTK+ UI (show other bugs)
Version: 1.0.3
Hardware: x86 Linux
: High Minor (vote)
Target Milestone: ---
Assignee: Wireshark-bugs mailing list
URL:
: 2736 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-08-13 17:25 UTC by Toralf Förster
Modified: 2009-06-03 04:26 UTC (History)
8 users (show)

See Also:


Attachments
patch to enable default SIGPIPE action (733 bytes, patch)
2008-10-09 07:48 UTC, James Westby
Details
set sa_flags variable (606 bytes, patch)
2008-11-26 02:56 UTC, Pavol Rusnak
Details
gcc -E for dumpcap.c (271.63 KB, text/plain)
2008-12-10 05:58 UTC, Toralf Förster
Details
config.h (9.07 KB, text/plain)
2008-12-26 08:55 UTC, Toralf Förster
Details
make.conf (1.74 KB, text/plain)
2009-01-02 02:15 UTC, Toralf Förster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster 2007-08-13 17:25:04 UTC
Build Information:
wireshark 0.99.7 (SVNRev 22493)

Copyright 1998-2007 Gerald Combs <gerald@wireshark.org> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled with GTK+ 2.10.13, with GLib 2.12.12, with libpcap 0.9.5, with libz
1.2.3, with libpcre 6.6, with Net-SNMP 5.2.1.2, without ADNS, without Lua, with
GnuTLS 1.4.4, with Gcrypt 1.2.2, without Kerberos, without PortAudio, without
AirPcap.

Running on Linux 2.6.22-gentoo-r2, with libpcap version 0.9.5.

Built using gcc 4.1.2 (Gentoo 4.1.2).

--
(1) start wireshark
(2) open Capture->Interface
(3) start capturing
(4) click at the "Close" button of the interface window

now this window hangs
Comment 1 Stephen Fisher 2007-09-25 04:18:04 UTC
According to gdb, when performing the actions described in the bug, Wireshark hangs at the wait() call (actually followed by a wait4() call on my OS X machine) at line 700 of file capture_sync.c:

    if (wait(&fork_child_status) != -1) {

This seems to be waiting for the second copy of dumpcap to end (the one doing the capturing) instead of the first one started (that lists all of the interfaces).  My suspicion of this being the case is backed up by a test where you can use the Unix kill command to terminate the first (interface listing) copy of dumpcap and the interfaces window will go away (although the capturing dumpcap seems to die next).  This functionality/code was introduced by Gerald in SVNrev 22071 as part of privilege separation efforts.

Comment 2 James Westby 2008-10-09 07:47:07 UTC
Hi,

Sergio Barjola did some more debugging on this issue, and
found the following,



looking at the process: gksudo---wireshark---dumpcap
I've found that gksudo is ignoring SIGPIPE signal, (ps -eo pid,ignored), so all childs process too, unless they change with sigaction.

Enable default action of SIGPIPE before gksudo create the child process works for me. (libgksu.c line 2506).




I've looking for why is SIGPIPE ignored in gksu process, and I found that it's caused by communication with gconfd server.
When a application connect to the gconfd daemon to get properties, the underlaying communication with CORBA it's ignoring SIGPIPE signal to avoid that if server crash, the process receive the signal and terminate.

package: liborbit2 1:2.14.12-0.1
file: linc2/src/linc.c (line: 247 see comment why is signal ignored)..



He came up with a patch to make wireshark work again, by enabling
the default action for SIGPIPE. I attach the patch here for your
review.

Thanks,

James
Comment 3 James Westby 2008-10-09 07:48:21 UTC
Created attachment 2335 [details]
patch to enable default SIGPIPE action
Comment 4 Balint Reczey 2008-10-30 05:05:17 UTC
(In reply to comment #3)
> Created an attachment (id=2335) [details]
> patch to enable default SIGPIPE action
> 

Committedrevision 26621.
Thanks for the patch!
Comment 5 Balint Reczey 2008-11-03 01:23:50 UTC
*** Bug 2736 has been marked as a duplicate of this bug. ***
Comment 6 Pavol Rusnak 2008-11-26 02:56:25 UTC
Created attachment 2523 [details]
set sa_flags variable

The patch is not setting sa_flags field of the sigaction structure. We could set it to 0, but I think SA_RESTART is more suitable. What do you think ?

Attaching patch (the affected code has moved from capture_opts.c to dumpcap.c meanwhile).
Comment 7 Balint Reczey 2008-11-26 04:57:05 UTC
Committedrevision 26851.
Thanks!

(In reply to comment #6)

Comment 8 Toralf Förster 2008-11-26 05:38:11 UTC
Hhm, probably I've to do a complete rebuild but the issue isn't solved with that svn commit ....
Comment 9 Toralf Förster 2008-11-29 06:14:09 UTC
I'd like to reopen this bug b/c the issue isn't solved with this version:

^Ctfoerste@n22 ~/devel/wireshark $ ./wireshark -v
wireshark 1.1.2 (SVNRev 26875)

Copyright 1998-2008 Gerald Combs <gerald@wireshark.org> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled with GTK+ 2.12.11, with GLib 2.16.5, with libpcap 0.9.8, with libz
1.2.3, without POSIX capabilities, with libpcre 7.8, without SMI, without
c-ares, without ADNS, without Lua, with GnuTLS 2.4.1, with Gcrypt 1.4.0, without
Kerberos, without GeoIP, without PortAudio, without AirPcap.

Running on Linux 2.6.26-gentoo-r3, with libpcap version 0.9.8.

Built using gcc 4.1.2 (Gentoo 4.1.2 p1.0.2).
Comment 10 Balint Reczey 2008-11-30 04:24:51 UTC
Could you check bug 2736?
I think it both bugs are caused by the same problem.
Could you check your dumpcap version, too?

(In reply to comment #9)
Comment 11 Toralf Förster 2008-11-30 05:52:25 UTC
Right, 

if I kill the dumpcap process (I see 2 withi the process list) I can continue to work with wireshark. Furthermore I use "su " to start wireshark:

tfoerste@n22 ~ $ su -c /home/tfoerste/devel/wireshark/wireshark
Password:
Comment 12 Toralf Förster 2008-11-30 05:53:55 UTC
BTW, here are the 2 processes, I killed the 2nd :

tfoerste@n22 ~ $ ps -efla | grep dumpcap
4 S root      9300  9242  0  80   0 -  3191 -      14:50 pts/1    00:00:00 /home/tfoerste/devel/wireshark/.libs/lt-dumpcap -S -M
4 S root      9316  9242  0  80   0 -  3191 -      14:50 pts/1    00:00:00 /home/tfoerste/devel/wireshark/.libs/lt-dumpcap -i eth0 -p -Z none
0 S tfoerste  9344  9332  0  80   0 -   936 -      14:50 pts/2    00:00:00 grep --colour=auto dumpcap
Comment 13 Balint Reczey 2008-12-01 04:14:06 UTC
Strange, i see one dumpcap process on my machine at a given time:
4 S root      8131  7564  0  80   0 -  3160 -      12:33 pts/3    00:00:00 /home/rbalint/Projects/wireshark/.libs/lt-dumpcap -i eth0 -Z none

or:
4 S root     12223  7564  0  80   0 -  3160 -      13:04 pts/3    00:00:00 /home/rbalint/Projects/wireshark/.libs/lt-dumpcap -S -M

Could you check the signal mask of your dumpcap processes?
(ps -eo pid,ignored)

(In reply to comment #12)
Comment 14 Toralf Förster 2008-12-01 06:24:16 UTC
tfoerste@n22 ~ $ ps -efla | grep dumpcap | fgrep -v grep
4 S root      9028  8738  0  80   0 -  3191 -      15:22 pts/1    00:00:00 /home/tfoerste/devel/wireshark/.libs/lt-dumpcap -S -M
4 S root      9095  8738  0  80   0 -  3192 -      15:22 pts/1    00:00:00 /home/tfoerste/devel/wireshark/.libs/lt-dumpcap -i eth0 -p -Z none
tfoerste@n22 ~ $ ps -eo pid,ignored | grep -e 8738
 8738 0000000000000000

Comment 15 Balint Reczey 2008-12-01 07:02:56 UTC
The signal mask is ok.
I think your problem is caused by compiling wireshark without POSIX capabilities.
Could you install libcap-dev and recompile wireshark?

(In reply to comment #14)
> tfoerste@n22 ~ $ ps -efla | grep dumpcap | fgrep -v grep
> 4 S root      9028  8738  0  80   0 -  3191 -      15:22 pts/1    00:00:00
> /home/tfoerste/devel/wireshark/.libs/lt-dumpcap -S -M
> 4 S root      9095  8738  0  80   0 -  3192 -      15:22 pts/1    00:00:00
> /home/tfoerste/devel/wireshark/.libs/lt-dumpcap -i eth0 -p -Z none
> tfoerste@n22 ~ $ ps -eo pid,ignored | grep -e 8738
>  8738 0000000000000000
> 

Comment 16 Toralf Förster 2008-12-01 09:23:30 UTC
I emerged the Gentoo package sys-libs/libcap-2.11 and run
$> ./configure CC="ccache gcc"
again, during that step I read this :

...
checking for mprotect... yes
checking for sysconf... yes
./configure: line 32931: : command not found
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doxygen.cfg
...

but it finished with :

...
The Wireshark package has been configured with the following options.
                    Build wireshark : yes
                       Build tshark : yes
                     Build capinfos : yes
                      Build editcap : yes
                      Build dumpcap : yes
                     Build mergecap : yes
                    Build text2pcap : yes
                      Build idl2wrs : yes
                      Build randpkt : yes
                       Build dftest : yes
                     Build rawshark : yes

             Install dumpcap setuid : no
                        Use plugins : yes
                   Build lua plugin : no
                   Build rtp_player : no
                        Use threads : no
             Build profile binaries : no
                   Use pcap library : yes
                   Use zlib library : yes
                   Use pcre library : yes
               Use kerberos library : no
                 Use c-ares library : no
               Use GNU ADNS library : no
                Use SMI MIB library : no
             Use GNU crypto library : yes
             Use SSL crypto library : no
           Use IPv6 name resolution : yes
                 Use gnutls library : yes
     Use POSIX capabilities library : yes
                  Use GeoIP library : no
...

but hte issue still remains.

BTW "Capture"->"Interfaces" gives :

tfoerste@n22 ~ $ ps -efla | grep dumpcap | fgrep -v grep
4 S root     16978 16439  0  80   0 -  3204 -      18:19 pts/3    00:00:00 /home/tfoerste/devel/wireshark/.libs/lt-dumpcap -S -M

After that I did an "Capture"->"Start", which yields into this state :

tfoerste@n22 ~ $ ps -efla | grep dumpcap | fgrep -v grep
4 S root     16978 16439  0  80   0 -  3204 -      18:19 pts/3    00:00:00 /home/tfoerste/devel/wireshark/.libs/lt-dumpcap -S -M
4 S root     17078 16439  0  80   0 -  3205 -      18:19 pts/3    00:00:00 /home/tfoerste/devel/wireshark/.libs/lt-dumpcap -i eth0 -p -Z none

closing now the interface windows did not work, but doing this :

tfoerste@n22 ~ $ su
Password:
n22 /home/tfoerste # kill 17078

brought back the application with a window saying : "Child capture process died: Broken pipe".

Comment 17 Balint Reczey 2008-12-03 05:27:06 UTC
I fixed the harmless error in configure (Commit 26893).
Are you sure that you have recompiled dumpcap, too?

(In reply to comment #16)
Comment 18 Toralf Förster 2008-12-03 06:09:25 UTC
(In reply to comment #17)
> Are you sure that you have recompiled dumpcap, too?
Yes, double checked it (made "make clean" before and checked "ls -l dumpcap")

Comment 19 Balint Reczey 2008-12-10 03:14:24 UTC
Could you try a make distclean, too?
If it does not eliminate the problem could you upload the preprocessed dumpcap.c?
Comment 20 Toralf Förster 2008-12-10 05:58:44 UTC
Created attachment 2550 [details]
gcc -E for dumpcap.c

The output of
$>make distclean && ./autogen.sh && ./configure CC="ccache gcc"

gives :

The Wireshark package has been configured with the following options.
                    Build wireshark : yes
                       Build tshark : yes
                     Build capinfos : yes
                      Build editcap : yes
                      Build dumpcap : yes
                     Build mergecap : yes
                    Build text2pcap : yes
                      Build idl2wrs : yes
                      Build randpkt : yes
                       Build dftest : yes
                     Build rawshark : yes

             Install dumpcap setuid : no
                        Use plugins : yes
                   Build lua plugin : no
                   Build rtp_player : no
                        Use threads : no
             Build profile binaries : no
                   Use pcap library : yes
                   Use zlib library : yes
                   Use pcre library : yes
               Use kerberos library : no
                 Use c-ares library : no
               Use GNU ADNS library : no
                Use SMI MIB library : no
             Use GNU crypto library : yes
             Use SSL crypto library : no
           Use IPv6 name resolution : yes
                 Use gnutls library : yes
     Use POSIX capabilities library : no
                  Use GeoIP library : no


And the output of

$>tfoerste@n22 ~/devel/wireshark $ gcc -E dumpcap.c -I /usr/include/glib-2.0/ -I wsutil/ -I /usr/lib/glib-2.0/include/ >dumpcap.c_gcc-E
dumpcap.c:85:31: error: wsutil/privileges.h: No such file or directory

is attached.
Comment 21 Balint Reczey 2008-12-19 05:41:45 UTC
I tried to reproduce the problem with a freshly installed Gentoo.

First, i installed the latest Gentoo using the live CD iso (Man, it took ages! :-)) in a virtal machine then i preformed the following steps:

emerge sync
emerge portage

# set USE="X gtk gnome -alsa" in /etc/make.conf

# followed instructions on http://bugs.gentoo.org/show_bug.cgi?id=234907

emerge -NuDav --fetchonly world
emerge -C ss com_err e2fsprogs
emerge -NuDav --nodeps e2fsprogs-libs e2fsprogs
echo "sys-libs/com_err" >>/etc/portage/package.mask
echo "sys-libs/ss" >>/etc/portage/package.mask
echo "sys-libs/com_err-1.40.11" >>/etc/portage/profile/package.provided
echo "sys-libs/ss-1.40.11" >>/etc/portage/profile/package.provided

# full update to avoid problems caused by outdated software
emerge -NuDav world

emerge wireshark subversion elinks
adduser -m virtual
gpasswd -a  virtual wheel
passwd virtual

# logged in as virtual (a normal user)
su -c wireshark # works
sudo wireshark # works

svn co http://anonsvn.wireshark.org/wireshark/trunk/ wireshark

./autogen.sh
./configure
make
make install

su -c "bash -c 'LD_LIBRARY_PATH=/usr/local/bin /usr/local/bin/wireshark'" # works
sudo bash -c 'LD_LIBRARY_PATH=/usr/local/bin /usr/local/bin/wireshark' # works


I suspect that there is some special configuration in your system or the problem is caused by outdated software.
Could you perform a deep update, install Gentoo's wireshark and try to reproduce the problem again?
Comment 22 Toralf Förster 2008-12-20 06:48:09 UTC
(In reply to comment #21)
> (Man, it took ages! :-)) in a virtal machine then i preformed the following steps:
Yep, Gentoo is a good compiler stress-test distribution, but since some days there are weekly built LiveCD w/ up-to-date packages available.

> I suspect that there is some special configuration in your system
Probably yes
> or the problem is caused by outdated software.
because I regularly make a (full/deep) update of all of my installed packages.

> Could you perform a deep update, install Gentoo's wireshark and try to
> reproduce the problem again?
Made it and I can reproduce the problem with the current gentoo package too - therefore probably a problem at my system ? 
:-(
Comment 23 Balint Reczey 2008-12-22 01:42:28 UTC
(In reply to comment #22)
> > Could you perform a deep update, install Gentoo's wireshark and try to
> > reproduce the problem again?
> Made it and I can reproduce the problem with the current gentoo package too -
> therefore probably a problem at my system ? 
> :-(
> 

I suspect. 
Could you upload your make.conf to make me able to match your system better in my virtual machine?
Comment 24 Toralf Förster 2008-12-26 08:55:24 UTC
Created attachment 2603 [details]
config.h

(In reply to comment #23)
> Could you upload your make.conf to make me able to match your system better in
> my virtual machine?
Yes, but I do not have that file but probably you mean config.h  ?
Comment 25 Balint Reczey 2008-12-29 06:19:12 UTC
(In reply to comment #24)
> Created an attachment (id=2603) [details]
> config.h
> 
> (In reply to comment #23)
> > Could you upload your make.conf to make me able to match your system better in
> > my virtual machine?
> Yes, but I do not have that file but probably you mean config.h  ?
> 
I tried the same configure parameters you probably used to produce the attached config.h (--without-krb5 --without-adns --without-libcap) and i still can't reproduce the problem.

I meant /etc/make.conf, btw.
Comment 26 Toralf Förster 2009-01-02 02:15:32 UTC
Created attachment 2612 [details]
make.conf

(In reply to comment #25)
> I meant /etc/make.conf, btw.
Ah ok, attached.
Comment 27 Toralf Förster 2009-01-04 08:25:11 UTC
BTW, the point (3) of this :

>(1) start wireshark
>(2) open Capture->Interface
>(3) start capturing
>(4) click at the "Close" button of the interface window

should be better written as
(3) open Capture->Start

If I click at the start button within Capture->Interface it works well.
Comment 28 Toralf Förster 2009-01-18 12:54:38 UTC
At least there is another user : http://forums.gentoo.org/posting.php?mode=quote&p=5401133&sid=2a61c55c9a96880e7f06877959689387

therefore it seems not to be a specific problem at my machine.
Comment 29 Ian Abbott 2009-02-04 04:29:18 UTC
Another Gentoo user here hitting the same bug. I'm using Gentoo's net-analyser/wireshark-1.0.5 ebuild.  I haven't tried the patches here yet, but have an additional nugget of information.

Gentoo allows ordinary users that are members of the "wireshark" group to run wireshark. The bug only seems to occur when running wireshark as one of these ordinary users. When run as root, there is no problem with the Capture Interfaces dialog (at least for me, but YMMV).
Comment 30 Balint Reczey 2009-02-24 02:36:13 UTC
For the record, the forum can be found here:
http://forums.gentoo.org/viewtopic-t-722531.html

Evildad posted on the referenced topic that net-analyzer/wireshark-1.1.1 worked for him.

Could you try net-analyzer/wireshark-1.1.2?

(In reply to comment #28)
> At least there is another user :
> http://forums.gentoo.org/posting.php?mode=quote&p=5401133&sid=2a61c55c9a96880e7f06877959689387
> 
> therefore it seems not to be a specific problem at my machine.
> 

Comment 31 Toralf Förster 2009-02-24 03:37:51 UTC
(In reply to comment #30)
> Could you try net-analyzer/wireshark-1.1.2?
> 

The latest svn version still contains the bug.
Comment 32 Peter 2009-03-05 09:18:38 UTC
Guys, why above patches were not applied to 1.0.x branch. Users still experience this problem: https://bugs.gentoo.org/show_bug.cgi?id=260457
Please, backport them.
Comment 33 Petr Sumbera 2009-03-06 03:04:28 UTC
I have increased priority as this is the first thing new user will run in.

Tested on Solaris while Wireshark 1.0.6 is started via pfexec (net_rawaccess privilege). patch to enable default SIGPIPE action is solving this.
Comment 34 Bugzilla Administrator 2009-05-21 17:19:18 UTC
Comment on attachment 2335 [details]
patch to enable default SIGPIPE action

Checked in several months ago inr26621.
Comment 35 Bugzilla Administrator 2009-05-21 17:33:47 UTC
Right now we set a SIGPIPE handler in print_statistics_loop(), which means we only set it when we run "dumpcap -S". Would it make more sense to set the handler no matter what?
Comment 36 Balint Reczey 2009-05-31 11:40:08 UTC
Committedrevision 28549.

Toralf, could you try that modified fix?

(In reply to comment #35)
> Right now we set a SIGPIPE handler in print_statistics_loop(), which means we
> only set it when we run "dumpcap -S". Would it make more sense to set the
> handler no matter what?
> 

Comment 37 Toralf Förster 2009-06-03 04:26:37 UTC
issue seems to be solved :-)