Closed phile314 closed 3 years ago
Using our test-suite I could reliably reproduce the error: a C finalizer called back into Haskell.
crash using master. With this diff, everything works as it should and the application terminates properly.
The CI errors seems to be because it uses a librdkafka version from March 2018, but rd_kafka_destroy_flags
has been added in August 2018. From the git log, it seems version 0.11.6 (revision 849c066b559950b02e37a69256f0cb7b04381d0e
) from October 2018 would suffice.
Thanks a lot! It was a long standing issue...
The rd_kafka_destroy method may call back into Haskell to perform some logging. This is not allowed when attaching the finalizer using Foreign.ForeignPtr. Hence we switch to Foreign.Concurrent, which allows RdKafka to call back into Haskell. We also disable closing the consumer automatically in the finalizer, this should be done by the application by calling
closeConsumer
explicitly.