Wireshark-dev: Re: [Wireshark-dev] wireshark 4.3.git deadlock on startup.

From: Ben Greear <greearb@xxxxxxxxxxxxxxx>
Date: Wed, 10 Jul 2024 16:44:49 -0700
On 7/10/24 16:08, John Thacker wrote:
Can you see if this commit fixes it for you?

https://gitlab.com/wireshark/wireshark/-/commit/0146fe4eb622a6a54d6ccb0e69488b594ec1fe50 <https://gitlab.com/wireshark/wireshark/-/commit/0146fe4eb622a6a54d6ccb0e69488b594ec1fe50>

John Thacker

It did not (I needed about 28kb, but I made the buffer much larger so
that next time someone tries with 1k interfaces it has a chance of working).

Really, should be fixed better but I don't know the code well and not overly
excited about re-writing the IPC between dumpcap and wireshark.

At the least, in the error condition you should probably close the pipe before
waiting on the remote process, as that will at least let the dumpcap process
to fail it's stdout write and not just deadlock.  Probably process whatever
you *did* receive as best as you are able.

Thanks,
Ben


On Wed, Jul 10, 2024, 6:17 PM Ben Greear <greearb@xxxxxxxxxxxxxxx <mailto:greearb@xxxxxxxxxxxxxxx>> wrote:

    Hello,

    We saw a lockup on a system with lots of network interfaces.
    I haven't looked at the code, but it smells like a somewhat common pipe related lockup
    where the child process is trying to write, but parent is not reading because it is
    waiting for child to complete, so child cannot finish writing and exit, so...deadlock.

    Any ideas on this?  Our build is a bit old, so we'll pull latest and see if
    it is reproducible...

    [root@ct523c-2175 ~]# wireshark --version
    Wireshark 4.3.0 (Git commit 2ae6c42ce290).

    wireshark:

    (gdb) bt
    #0  0x00007f7ab3edccbf in wait4 () from /lib64/libc.so.6
    #1  0x00005636a4d31d66 in sync_pipe_wait_for_child.lto_priv ()
    #2  0x00005636a4d4ff06 in sync_interface_stats_open.constprop ()
    #3  0x00005636a4ab6334 in InterfaceFrame::scanLocalInterfaces(_GList*) ()
    #4  0x00007f7abd3b1385 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt6Core.so.6
    #5  0x00005636a49caac6 in MainApplication::scanLocalInterfaces(_GList*) ()
    #6  0x00005636a4994c0a in main ()
    (gdb)

    dumpcap (what is being waited upon):

    (gdb) bt
    #0  0x00007f7182301c37 in write () from /lib64/libc.so.6
    #1  0x00007f718228496d in _IO_file_write@@GLIBC_2.2.5 () from /lib64/libc.so.6
    #2  0x00007f7182283d10 in new_do_write () from /lib64/libc.so.6
    #3  0x00007f71822859d9 in __GI__IO_do_write () from /lib64/libc.so.6
    #4  0x00007f7182283b48 in __GI__IO_file_sync () from /lib64/libc.so.6
    #5  0x00007f718227944c in fflush () from /lib64/libc.so.6
    #6  0x0000563c67f170a9 in print_statistics_loop ()
    #7  0x0000563c67f118e9 in main ()
    (gdb)

    Thanks,
    Ben

-- Ben Greear <greearb@xxxxxxxxxxxxxxx <mailto:greearb@xxxxxxxxxxxxxxx>>
    Candela Technologies Inc http://www.candelatech.com <http://www.candelatech.com>

    ___________________________________________________________________________
    Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx <mailto:wireshark-dev@xxxxxxxxxxxxx>>
    Archives: https://www.wireshark.org/lists/wireshark-dev <https://www.wireshark.org/lists/wireshark-dev>
    Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev <https://www.wireshark.org/mailman/options/wireshark-dev>
                  mailto:wireshark-dev-request@xxxxxxxxxxxxx <mailto:wireshark-dev-request@xxxxxxxxxxxxx>?subject=unsubscribe


___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
              mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe

--
Ben Greear <greearb@xxxxxxxxxxxxxxx>
Candela Technologies Inc  http://www.candelatech.com