Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3291

ChangeStreamBatchCursor is not interruptable

    XMLWordPrintable

    Details

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

      Description

      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();

       

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: