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

ChangeStreamBatchCursor is not interruptable

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.11.0
    • Affects Version/s: None
    • Component/s: Query Operations
    • 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@mongodb.com John Stewart (Inactive)
            Reporter:
            kevin.rosendahl@mongodb.com Kevin Rosendahl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: