confluentinc / librdkafka

The Apache Kafka C/C++ library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mock cluster's main thread does not retry when `poll()` returns EINTR, resulting in shutdown

terryburton opened this issue · comments

Description

External events such as signals and activities performed by other threads may routinely interrupt the mock cluster thread's poll() system call.

This situation is currently treated as an error resulting in shutdown of the mock cluster. It would be better to retry if poll() returns EINTR.

There may be equivalent considerations for win32.

Context: The mock cluster has been initialised within an application that subsequently calls setresuid (which interrupts system calls).

Checklist

  • librdkafka version: Up to current HEAD 2587cac70f83fced42c51f921bed325a434f5bc7
  • Apache Kafka version: N/A
  • librdkafka client configuration: test.mock.num.brokers = N
  • Operating system: POSIX flavour
  • Provide logs (with debug=.. as necessary) from librdkafka: See below
  • Provide broker log excerpts: N/A
  • Critical issue

Producer logs

Thu May 23 16:56:57 2024 : Info: [thrd:app]: Mock cluster enabled...
...
[ Mock cluster thread's poll() system call interrupted, returning EINTR. Treated as error, rather than retried. ]
Thu May 23 16:56:58 2024 : Error: [thrd:mock]: Mock cluster failed to poll 5 fds: -1: Interrupted system call
[ Results in teardown of the mock cluster. ]
...
Thu May 23 16:56:58 2024 : Error: [thrd:127.0.0.1:34819/bootstrap]: 127.0.0.1:34819/1: Connect to ipv4#127.0.0.1:34819 failed: Connection refused (after 0ms in state CONNECT)
Thu May 23 16:56:59 2024 : Error: [thrd:127.0.0.1:43461/bootstrap]: 127.0.0.1:43461/3: Connect to ipv4#127.0.0.1:43461 failed: Connection refused (after 0ms in state CONNECT)
Thu May 23 16:56:59 2024 : Error: [thrd:127.0.0.1:43461/bootstrap]: 3/3 brokers are down
...