ChangeStreamBatchCursor is not interruptable

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 3.11.0
    • Affects Version/s: None
    • Component/s: Query Operations
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      ChangeStreamBatchCursor is currently swallowing MongoInterruptedException as a retryable error, making threads which are blocked watching a change stream uninterruptible.

       

      Minimal reproduction which hangs forever:

       

      final Thread t =
          new Thread(
              () -> {
                try {
                  for (final ChangeStreamDocument<Document> doc : collection.watch()) {
                    System.out.println(doc);
                  }
                } catch (final MongoInterruptedException e) {
                 System.out.println("interrupted");
                }
              });
      
      t.start();
      
      Thread.sleep(1000);
      
      t.interrupt();
      t.join();

       

            Assignee:
            John Stewart (Inactive)
            Reporter:
            Kevin Rosendahl
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: