Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
With MINIFICPP-1351, I introduced a connection lock before the message lock to avoid a race condition on closing the connection. It went before the message lock, because when both are taken, connection lock has to come first to avoid a deadlock.
This caused notifyStop to wait until the messages in flight timed out and onTrigger stopped before being able to take the connection lock, then the message lock, then interrupt the messages, thus defeating the interruption.
This issue is about fixing the situation by first taking the message lock without the connection lock, interrupting the messages, then releasing the lock and taking the connection lock (after onTrigger terminated early, thanks to the interruptions) and terminating the connection.
Aside from that, I made an effort to reduce the runtime of PublishKafkaOnScheduleTests when no local kafka nodes are running. It tries to connect to one and waits for timeout, but the test doesn't need an actual running broker, this is just a side effect. Reduced timeouts, the runtime went from ~30sec to ~1.5sec.