ngageoint / endpoint.js

Web application discovery, execution and streaming library
http://ngageoint.github.io/endpoint.js/
Apache License 2.0
26 stars 5 forks source link

Multiplexer / Streamer race condition, Infinite loop #8

Closed datasedai closed 8 years ago

datasedai commented 8 years ago

As follows:

  1. A multiplexed stream is established
  2. Host A writes to stream and calls end()
  3. Host A ends stream on next tick, streamer deletes reference to stream
  4. Host B reads and writes response back to host A
  5. Host B reads 'end', calls end() and removes reference to stream in mux-stream and streamer
  6. Host A reads stream data from Host B. Streamer does not know about stream, creates a reference and passes the message to mux-stream. Mux-stream does not know stream id, replies with p:error
  7. Host B reads p:error and doesn't know stream, replies with p:error ... and on and on

Two problems occur:

  1. The infinite p:error loop
  2. The leaking of references to non-existent streams in streamer. Streamer trusts that any message for any stream it doesn't know about is a 'new' message, and passes it onto the multiplexer with that assumption.