Build Information:
Wireshark 1.99.2-747-g5162b7f1 (v1.99.2rc0-747-g5162b7f1 from unknown)
Copyright 1998-2015 Gerald Combs <gerald@wireshark.org> and contributors.
License GPLv2+: GNU GPL version 2 or later <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
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 (64-bit) with Qt 5.3.2, with libpcap, without POSIX capabilities, with
libz 1.2.3, with GLib 2.36.0, with SMI 0.4.8, without c-ares, without ADNS, with
Lua 5.2, with GnuTLS 2.12.19, with Gcrypt 1.5.0, with MIT Kerberos, with GeoIP,
without PortAudio, with AirPcap.
Running on Mac OS X 10.8.5, build 12F45 (Darwin 12.5.0), with locale
en_US.UTF-8, with libpcap version 1.1.1, with libz 1.2.5, with GnuTLS 2.12.19,
with Gcrypt 1.5.0, without AirPcap.
Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz (with SSE4.2)
Built using llvm-gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build
2336.9.00).
Using QT based Wireshark on OS X there is a race condition issue when switching between files using the "Files in Set" dialog which can raise the following message box:
Do you want to stop the capture and save the captured packets?[Stop and Continue without Saving] [Cancel] [Stop and Save]
If one selects [Cancel] then QT Wireshark will crash. If one selects [Stop and Continue without Saving] then the message box goes away, but QT Wireshark's GUI will not allow one to open or close any capture file nor can one select "Quit"; the Wireshark process must be killed.
Background:
Wireshark has long supported a feature called "File Sets". Wireshark "File Sets" have a specific type of naming convention that is exploited using the "Files In Set" dialog. If the currently open capture file follows the Wireshark "File Set" naming convention then the "Files in Set" dialog is available from menu "File" -> "File Set" -> "List Files".
A Wireshark "File Set" can be created using tshark's and dumpcap's -b feature or within Wireshark's Capture dialog using the "Create a new file automatically" feature or using editcap's -c or -i split capture features.
Once the "Files in Set" dialog is open one can quickly switch between any of the files in "File Set" by simply selecting a different file name from the list.
If the File Set capture files are large (> 50MB) then it generally takes several seconds to fully load the capture file. If one selects a new trace file before the previous file has been completely loaded then the unexpected message box is displayed. The unexpected message box will also be presented by simply using the Up and Down arrow keys to quickly scroll up and down the list of files.
I've tested with recent buildbot images from master (Version 2.1.0-3050-g72bba57d) on both OS X 10.10.5 and Windows 8.1.
I can easily force an issue on both OSes with even tiny capture files. Wireshark will effectively become non-responsive. Once unresponsive one can open some menus nut most of items (like Quit Wireshark) will be greyed and unavailable to select. Once Wireshark becomes unresponsive top reports Wireshark consuming 100%.
Interestingly I am not seeing the message box that I reported earlier. Instead I see a pair of messages in the console log (On OS X I start wireshark from terminal window, on Windows I have set preferences to always open a console window). Here's an annotated example of what I see on OS X once I've successfully opened the Files in Set dialog:
<snip> <=== Scroll to new file entry in "File in Set" dialog 11:45:48 Main Dbg Callback: Closing 11:45:48 Main Dbg Callback: Closed 11:45:48 Main Dbg Callback: Opened 11:45:48 Main Dbg Callback: Read started 11:45:48 Main Dbg Callback: Read finished <=== Next capture is displayed <=== Scroll to new file entry in "File in Set" dialog 11:45:49 Main Dbg Callback: Closing 11:45:49 Main Dbg Callback: Closed 11:45:49 Main Dbg Callback: Opened 11:45:49 Main Dbg Callback: Read started 11:45:49 Main Dbg Callback: Read finished <=== Next capture is displayed <=== Scroll to new file entry in "File in Set" dialog 11:45:50 Main Dbg Callback: Closing 11:45:50 Main Dbg Callback: Closed 11:45:50 Main Dbg Callback: Opened 11:45:51 Main Dbg Callback: Read started 11:45:51 Main Dbg Callback: Read finished <=== Next capture is displayed > <=== Scroll to new file entry in "File in Set" dialog > 11:45:51 Main Dbg Callback: Closing > 11:45:51 Main Dbg Callback: Closed > 11:45:51 Main Dbg Callback: Opened > 11:45:51 Main Dbg Callback: Read started > <=== Scroll to new file entry in "File in Set" dialog > 11:45:51 Capture Msg Capture Stop ... > 11:45:51 Main Dbg Callback: capture stopping > <=== Wireshark starts consuming 100% of CPU > <=== Scroll to new file entry in "File in Set" dialog > 11:45:51 Capture Msg Capture Stop ... > 11:45:51 Main Dbg Callback: capture stopping > <=== Scroll to new file entry in "File in Set" dialog > 11:45:51 Capture Msg Capture Stop ... > 11:45:51 Main Dbg Callback: capture stopping > <=== Wireshark terminated from console with CTRL-C. >^C
Steps to reproduce:
Create a capture fileset. I created a series of small 2 packet captures by starting a once-a-second ping to some local target. Start Wireshark and open the Capture Options dialog. On the Input tab select the desired interface (if not already selected). Now open the Output tab. Enter a filename in the "Capture to a permanent file" (for example pingtest01.pcapng) and set the option entries to "Create a new file automatically ..." every 1 second. Start the capture and let it run run for 60 seconds of so. This should result in approximately 60 capture files (depending on when you Stop capturing). The last file in the capture set should be displayed.
At this point you should be able to open the "Files in Set" dialog (File | File Set | List) but for some reason when the Files in Set dialog is opened it sometimes reports in the title "No files in set" and in the Directory: field report "No capture opened". I've submitted Bug #12451 (closed) regarding the inconsistent ability to open the Files in Set dialog.
Once you have successfully opened the "File in Set" dialog and can see a set of captures start scrolling in the list to select a new capture file. As you scroll up and down a new capture file should be presented. But at some point if you scroll between multiple files Wireshark will become unresponsive.
Nope not a crash. Wireshark is still open as is the Files in Set dialog. As I continue to scroll across other entries in the Files in Set dialog Wireshark will log a new pair of messages to the console:
Note there was NO active capture running when this started. The first of these pair of messages appeared where I was instead expecting:
> 11:45:51 Main Dbg Callback: Read finished
I am able to close the Files in Set dialog but am unable to quit Wireshark. I have to force it to exit in some manner (in my case Ctrl-C via terminal window I launched it from).
Yes the issue persists. In fact I can now reliably trigger a crash. I've attached a gzipped tar file of a fileset that can be used.
Download the capture fileset.
Extract the files.
Open Wireshark.
Open the first file in the fileset.
Open the fileset dialog (File -> File Set -> List Files)
Click on the first entry in the Wireshark: NN Files In Set dialog.
Press the down arrow repeatedly to quickly select subsequent files in the fileset list.
Fun ensues.
The call trace of the problematic scenario matches #13594 (comment 400724361), again the dialog callback ends up destroying stuff too early:
#4 0x00005555565c16ce in cf_close file.c:361#5 0x00005555565bf33d in cf_open file.c:261#6 0x000055555683ea0f in MainWindow::openCaptureFile ui/qt/main_window_slots.cpp:235#7 0x000055555677e188 in MainWindow::openCaptureFile ui/qt/main_window.h:301...#10 0x0000555557569288 in FileSetDialog::fileSetOpenCaptureFile ui/qt/qtui_autogen/EWIEGA46WW/moc_file_set_dialog.cpp:154...#18 0x00007fffddc0ccaf in QTreeView::setSelection /usr/lib/libQt5Widgets.so.5...#39 0x00005555569cb97d in update_progress_dlg ui/qt/progress_frame.cpp:77#40 0x00005555565c567b in cf_read file.c:609#41 0x000055555683ec10 in MainWindow::openCaptureFile ui/qt/main_window_slots.cpp:246#42 0x000055555677e188 in MainWindow::openCaptureFile ui/qt/main_window.h:301#43 0x0000555556882d30 in MainWindow::on_actionFileOpen_triggered ui/qt/main_window_slots.cpp:1670...#62 0x00005555566817c9 in main ui/qt/main.cpp:908
Change 28578 merged by Peter Wu:
Qt: fix crash on opening a capture file while loading/saving another
...
Note: there might be some interaction glitches (e.g. file open actions that are ignored), but not crashing should already be an improvement on itself.
Confirm that this patch appears to prevent crashes that were previously so easy to trigger.
Also confirm some UI interaction glitches. Specifically within the fileset dialog when quickly switching between entries (with keyboard or mouse) the entry ultimately selected in the fileset dialog may not in fact be the one displayed in Wireshark. Clicking on the selected entry in the fileset dialog will not re-trigger the an open event. To open the selected entry one must select another entry in the fileset dialog and then come back to the originally selected entry.
Also confirm some UI interaction glitches. Specifically within the fileset dialog when quickly switching between entries (with keyboard or mouse) the entry ultimately selected in the fileset dialog may not in fact be the one displayed in Wireshark. Clicking on the selected entry in the fileset dialog will not re-trigger the an open event. To open the selected entry one must select another entry in the fileset dialog and then come back to the originally selected entry.
That is a side-effect of the current "fix". Previously it would happily proceed and try to destroy the ongoing capture file data structures. Now it will refuse to do that, but it will not try to open the capture file either. If you watch your console output, you will see a number of messages such as:
Warn Refusing to close "split_00002_19691231213320.pcap" which is being read.
Actually addressing that is a bit harder. Some options:
When MainWindow::openCaptureFile is called but not possible, save the filename and "somehow" queue it until "cf_read" (or similar) returns.
Problem: cannot directly emit a signal since that would keep "update_progress_dlg" looping forever in "WiresharkApplication::processEvents".
Possible workaround: cancel any pending timers and start a new one that executes in 100ms, hopefully "cf_open" has returned by then.
More rigorous: modify "cf_read" and friends not to call "update_progress_dlg". Instead create a second thread for I/O and let the main (GUI) thread interact with it through signals. Adds various thread safety issues. Adding Gerald in cc, perhaps he has some further input for this approach.
Jim, do you want to reopen this bug to address the above glitch or create a new one?