[JAVA-2534] why the getmore method sudden stop Created: 09/Jun/17  Updated: 27/Oct/23  Resolved: 09/Jun/17

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: 3.4.2
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: kunyin Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File 20170609.log     PNG File 无标题.png    

 Description   

use the code bellow:
MongoCollection<Document> collection = database.getCollection("oplog.rs");
MongoCursor<Document> cursor = collection.find().cursorType(CursorType.TailableAwait).iterator();
while(cursor.hasNext())

{ System.out.println(cursor.next().toJson()); }

why the getmore command disappeare



 Comments   
Comment by Jeffrey Yemin [ 09/Jun/17 ]

It stopped because the replica set primary at 127.0.0.1:27017 became unreachable:

2017-06-09 02:49:47 WARN [main] com.mongodb.diagnostics.logging.SLF4JLogger.warn(86) | Got socket exception on connection [connectionId{localValue:7, serverValue:48377276}] to 127.0.0.1:27017. All connections to 127.0.0.1:27017 will be closed.
2017-06-09 02:49:47 DEBUG [main] com.mongodb.diagnostics.logging.SLF4JLogger.debug(56) | Invalidating the connection pool
2017-06-09 02:49:47 TRACE [main] com.mongodb.diagnostics.logging.SLF4JLogger.trace(41) | Handling description changed event for server 127.0.0.1:27017 with description ServerDescription{address=127.0.0.1:27017, type=UNKNOWN, state=CONNECTING}
2017-06-09 02:49:47 DEBUG [main] com.mongodb.diagnostics.logging.SLF4JLogger.debug(56) | Updating cluster description to  {type=REPLICA_SET, servers=[{address=127.0.0.1:27018, type=REPLICA_SET_SECONDARY, roundTripTime=16.2 ms, state=CONNECTED}, {address=127.0.0.1:27019, type=REPLICA_SET_SECONDARY, roundTripTime=7.8 ms, state=CONNECTED}, {address=127.0.0.1:27017, type=UNKNOWN, state=CONNECTING}]
2017-06-09 02:49:47 DEBUG [main] com.mongodb.diagnostics.logging.SLF4JLogger.debug(56) | Invalidating the connection pool

That will certainly caused getMore execution to complete abnormally and an exception thrown from cursor iteration. I suggest looking at the mongod logs for that server to see why that happened.

Comment by kunyin [ 09/Jun/17 ]

Hi Ross Lawley,
i don't find the "Command execution completed" debugging message until the connection close,please help

Comment by Ross Lawley [ 09/Jun/17 ]

Hi yin,

Thanks for the ticket, could you include a text copy of the logs? The image doesn't provide enough information to determine what is happening. Please remember to remove any sensitive information from the log before attaching to this ticket.

The "Command execution completed" debugging message is only outputted after the command response has been returned from the server.

Ross

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