Skip to content

fix a deadlock in the consumer mock#451

Merged
frairon merged 1 commit intolovoo:masterfrom
moonpolysoft:fix-deadlock-in-consumer-mock
Apr 28, 2024
Merged

fix a deadlock in the consumer mock#451
frairon merged 1 commit intolovoo:masterfrom
moonpolysoft:fix-deadlock-in-consumer-mock

Conversation

@moonpolysoft
Copy link
Contributor

Found a deadlock in the MockAutoPartitionConsumer. The Close() function does all of its work from within a sync.Once. However, the AsyncClose() function utilizes the same sync.Once to do its work. Close() calls AsyncClose() from within the once invocation and results in a deadlock as the mutex is being held by the outer Close().

This change inlines the operations AsyncClose() would've performed into the main body of Close(), removing the possibility for deadlock.

@frairon
Copy link
Contributor

frairon commented Apr 28, 2024

Good catch, thanks a lot @moonpolysoft !

@frairon frairon merged commit d8004e7 into lovoo:master Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants