New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PacketGetStats() sometimes fails with ERROR_OPERATION_ABORTED #1650
Comments
I could also reproduce it by capturing on the (virtual) Bluetooth device. |
I suspect this is a suspend/resume issue of some sort. |
When Windows suspends, NDIS filter driver modules are detached from the adapters, which means any open pcap handles ought to be invalid. I'm not sure how to communicate this to libpcap-using software. Maybe there's a useful error (GetLastError) from the PacketReceivePacket call? That basically returns the result of ReadFile on the handle, but I don't see the pcap's errbuf being filled in |
"Invalid" in the sense that the
If either 1) the USB Wi-Fi device is unplugged from the system or 2) I do a suspend and resume on the virtual machine, Given that
It is, but it's not filled in with a string for the error code, it's just filled in with a generic error; I changed that to find out what error was returned from |
Also, is there some way for some part of the NPF kernel code to catch suspends or resumes and re-plumb the filter so that capturing can continue in the suspend/resume case (it obviously can't continue if you unplug the device from the system)? |
Ok, this is starting to make sense! The Packet API gets NPF device handles with I think there may be a way to preserve state on the filter driver side and re-attach the open device handles to the appropriate adapters when they are restored, but it would require a lot of changes and still we'd need a way to tell the owning process that the handle isn't available right now. I'm not sure that's worth it. I will be checking in a change that might help a bit: in the |
As long as the device driver is open, a It would also be good if the packet buffer also remained available, so that Replumbing the filter driver is less important - an application doing a long-running capture should try to prevent sleep during the capture. |
The appropriate error for the interface going away would probably be |
Yes, that seems doable. We have a release in testing already, so it won't be in 0.997, but I hope to work on it for 0.998. And one of these days, I suppose we'll have to have a 1.0 release :) |
Is there anything else - other than a sleep/wakeup pair or the removal of the device - that would cause 1) |
…ale ones. See nmap/nmap#1650" This reverts commit 34fd597. Because NPF_Close (IRP_MJ_CLOSE handler) checks NPF_IsOpenInstance, this resulted in Driver Verifier bugcheck due to not freeing the OPEN_INSTANCE. Reverting this change until a more complete solution is done, probably after the next release.
This should be fixed in Npcap 0.9983, released today. Statistics and some of the other functions can still be called on a paused or removed network adapter, and it may be possible to continue capturing after a sleep, though I haven't tested that particularly. If there are additional changes related to this issue that you would like to see, please open a new issue to describe them. Thanks again! |
Thanks! I've updated Wireshark bug 14101 to be a bug for updating the version of Npcap that Wireshark bundles into the installer to 0.9983 (and to tell users seeing this problem to update to 0.9983). |
Wireshark bug 14101 is now RESOLVED/FIXED; one person reporting this problem says:
so 0.9983 seems to have made a major improvement here. Kudos! |
Thanks for the update, @guyharris. We're delighted to hear it! |
A number of Wireshark bugs have been filed due to a
Can't get packet-drop statistics: PacketGetStats error: The I/O operation has been aborted because of either a thread exit or an application request. (995)
error.
That comes from a
pcap_stats()
call in the dumpcap program (the program that does traffic capture for Wireshark and TShark). That ultimately turns into aBIOCGSTATS
DeviceIoControl()
call; that call isn't overlapped, so:pcap_t
, and I don't see any path to close thepcap_t
before thepcap_stats()
call;Looking at the driver (from current Git master), I don't see any obvious way that
ERROR_OPERATION_ABORTED
would be returned.I can reproduce this with Wireshark 3.0.2 and Npcap 0.995, running on Windows 7 in a virtual machine on my Mac, with a USB Wi-Fi adapter attached to the VM, by starting a capture on the Wi-Fi adapter and then suspending and restarting the virtual machine.
The first error I get is
"The network adapter on which the capture was being done is no longer running; the capture has stopped."
which is probably dumpcap's translation of a "read error: PacketReceivePacket failed" error reported by Npcap (dumpcap maps various errors reported by libpcap/WinPcap/Npcap for an interface going down into that message; I need to arrange for a way for pcap to return a common "interface went down, capture stopped" error).
When I dismiss that dialog, I get the
"Can't get packet-drop statistics: PacketGetStats error: The I/O operation has been aborted because of either a thread exit or an application request. (995)"
error.
The text was updated successfully, but these errors were encountered: