Skip to content

Conversation

@afham123
Copy link
Contributor

@afham123 afham123 commented Sep 3, 2025

RCA

subscribe method sits at the place where deadlock issue is initiated. We would be making the subscribe function independent from the broadcast server, eliminating the possibility of deadlock caused by the addListener channel. By directly adding the listner into the list. This would aviod the deadlock issue where the server is bussy with other operation and new listerner waiting to be pushed inside the listener list and server is waiting for the listener to be added.

fix and improvement

  • Remove the addListener channel from the broadcastServer. We Directly append the new listener to the listeners slice inside the Subscribe method. Making the code easier to understand and maintain. Directly appending to the listeners slice avoids the overhead of using an additional channel.
  • Similarly removing the removeListener channel and directly perform the operation to remove a listener from the listeners slice. This simplifies the code and avoids the need for an additional channel.
  • Simplifying the code.
  • Creating the Hit listeners prior to the sending the Hits from the Hits scan jobs.
  • Moving the wait group and context up in the main thread at the starting of the job.
  • Structure enhancement and optimising the broadcast server.
  • Adding abstraction on the broadcast server.
  • Structuring the broadcast server in a more optimistic way and easy to understand way.

@afham123 afham123 changed the title Deadlock eh test Deadlock e3h test Sep 3, 2025
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