Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-20348

AsyncMockStream framework is not asynchronous

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.8
    • Affects Version/s: 3.1.8
    • Component/s: Networking
    • None
    • Fully Compatible
    • ALL
    • Platform 9 (09/18/15)

      The async mock stream framework offers a stream that pauses itself to allow the tester to inspect state that has been written to it or read from it by the network interface. Those "pauses" are implemented as follows:

      MockStream::write(buffer, handler) {
           ...
           block(kBlockedAfterWrite);
           ...
           _io_service->post(next task);
      }
      

      This causes the NIA's thread, which has called write(), to hang until the test unblocks it. Then it cannot use that thread for other things, like checking for timed out operations, while the write is "blocked on a socket."

      We should return instead of blocking there, essentially pausing that path of the state machine. The call to unblock(), instead of actually unblocking, should post a new handler to the io_service that runs the part of write() that would have happened after the block.

            Assignee:
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Reporter:
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: