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
Call handle.Close method has been blocked #1126
Comments
I have met the same issue. Are there any solution to bypass such issues ? |
I solved the problem by setting a reasonable timeout. As you can see, the timeout in my code is set to pcap.BlockForever. This value is a negative number and causes blocking problems.
I noticed that Handle's ReadPacketData will be locked, and the synchronization variable is mu.The structure of Handle is as follows
In the Packets() method of PacketSource, a goroutine is opened to call the ReadPacketData method in a loop. The source code of this method is as follows
Note the getNextBufPtrLocked method,When the timeout parameter is less than 0, this method seems to block uniformly.As a result, the lock cannot be released.
Pay attention to these two lines of code
|
I got the forked version gopacket/gopacket which soloved this issue by anthor way, but also thanks very much for reply! |
I found a similar issue
#253
I noticed that this problem has been fixed, but it seems to be reproduced in my code, and the version I am using is v1.1.19
My code is as follows
I found that this function cannot end normally, and "begin close..." can be output normally but "closed..." cannot be output
The text was updated successfully, but these errors were encountered: