Skip to content
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

Intermittent SIGSEGV in finalizer for BpfProgram #80

Closed
lampad opened this issue Dec 15, 2016 · 2 comments
Closed

Intermittent SIGSEGV in finalizer for BpfProgram #80

lampad opened this issue Dec 15, 2016 · 2 comments
Labels

Comments

@lampad
Copy link

lampad commented Dec 15, 2016

I'm writing a JRuby wrapper for pcap4j (thanks for all your hard work): https://github.com/lampad/pcap4JRuby using jruby-9.1.6.0, and have been running into an intermittent segfault when i run my unit test suite bundle exec rake a few times. I've been working on getting a more streamlined, reproducible segfault test, and will update later when I have something.

I noticed that this was committed a while ago: 36a5b43

I had been having the same problem that was described in #64, and after that commit, the mention of JNA in the stack disappeared. However, I'm still getting the segfault and it appears to be caused by the freeing of the BpfProgram in org.pcap4j.core.NativeMappings.pcap_freecode I suspect a double free, since the memory address seems to point to a null address (one that has already been freed?)

I've attached the log below.
hs_err_pid9247.txt

Let me know if you have any questions.

@kaitoy
Copy link
Owner

kaitoy commented Dec 15, 2016

It looks the error can be avoided by checking the freed flag in free().
I made the fix. Please try this: https://oss.sonatype.org/content/repositories/snapshots/org/pcap4j/pcap4j-distribution/1.7.1-SNAPSHOT/pcap4j-distribution-1.7.1-20161215.220212-3-bin.zip

And, now I believe implementing finalize method is problematic. So I will remove it in Pcap4J 2.0.0

@lampad
Copy link
Author

lampad commented Dec 16, 2016

Looks like that addressed it. Thanks for the quick turnaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants