Skip to content

Poseidon Socket-IO "Race Condition" Issue

Context

At some point, Poseidon makes a request through the socket-io API to know about the MP4 codecs. So:

  1. Emit a MP4 event
  2. Emit a MP4Command event

Problem Those 2 steps are executed asynchronously. But, in the backend socket-io API code, the MP4Command begins to listen inside the MP4 event, so when the client send both simultaneously, then the MP4 arrives at the server side, but it won't be listen, because it had not been defined at that point. In summary, is a well known race condition problem.

Solution Make a dependency on its event handlers and communicate to the client when the MP4 event callback was loaded and then notify that is ready to listen to the MP4Command. In that way, it assure that the client will receive an answer always.

Merge request reports