-
Notifications
You must be signed in to change notification settings - Fork 24
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
Segmentation fault trying to capture SIGINT #12
Comments
Thanks for reporting this! The problem is not 100% reproducible, but I think it comes from our finalizers - before Julia object is garbage-collected, we destroy the corresponding C objects. But librdkafka seems to also catch SIGINT before us and destroy the resources on its own, leaving us with invalid handles. Unfortunately I can't see any API to check if a handler is still valid to include it into finalizers. Is there a reason you want to terminate the process with SIGINT instead of, say, checking a terminating flag in the consumption loop? Relevant docs: https://github.com/edenhill/librdkafka/blob/master/INTRODUCTION.md#termination |
SIGINT handling was my first approach because my application is a background process that is managed by a supervisor, in my case The default mechanism of stopping a process by a supervisor is sending a signal to the process. Apart from that I think my overall approach has to be changed because, for what I understand, The presence of two event loops, and the internal houskeeping of threads and async tasks of Julia and the "out of julia control" |
According to the documentation:
I don't think there's additional (asynchronous) event loop in librdkafka, just old plain synchronous threads, 1 main thread and one thread per broker. In a typical scenario you start a consumer and run it for a long time without interruptions, so I don't see any source for conflicts between threads or asynchronous tasks here. Segfault instead of SIGINT is an unfortunate detail which I hope we will find a way to deal with, but if it's caused by |
Thanks! looking at the sources there is not an event loop in librdkafa, I probably got confused from a misinterpretation of some test case. Based on this, I don't see any others reason to worry about multithreading in librdkfka. |
I've a patch that seems to works correctly regarding this issue. I've removed all https://github.com/edenhill/librdkafka/blob/master/INTRODUCTION.md#high-level-kafkaconsumer In the case of consumer this implies that he user has to explicitly close the consumer:
Another source of problem was the timer I'm sending a Pull Request ... Attilio |
In my consumer I'm not able to capture SIGINT and exit in a controlled way: instead of capturing an
InterruptException
I got a segmentation fault.Below a minimal working example,
consume.jl
, for reproducing the problem:result:
The text was updated successfully, but these errors were encountered: