[JAVA-3291] ChangeStreamBatchCursor is not interruptable Created: 16/May/19  Updated: 28/Oct/23  Resolved: 24/Jul/19

Status: Closed
Project: Java Driver
Component/s: Query Operations
Affects Version/s: None
Fix Version/s: 3.11.0

Type: Bug Priority: Major - P3
Reporter: Kevin Rosendahl Assignee: John Stewart (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates JAVA-3290 Change streams resume after thread is... Closed

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

 



 Comments   
Comment by Githook User [ 01/Aug/19 ]

Author:

{'name': 'John Stewart', 'email': 'john.stewart@mongodb.com', 'username': 'jstewart-mongo'}

Message: Declare MongoInterruptedException as a non-retryable error

JAVA-3291
Branch: mongot
https://github.com/mongodb/mongo-java-driver/commit/86eebeb25c95fade156a10bed293fbcb2c5d9cff

Comment by Githook User [ 24/Jul/19 ]

Author:

{'name': 'John Stewart', 'email': 'john.stewart@mongodb.com', 'username': 'jstewart-mongo'}

Message: Declare MongoInterruptedException as a non-retryable error

JAVA-3291
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/86eebeb25c95fade156a10bed293fbcb2c5d9cff

Generated at Thu Feb 08 08:59:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.