Details
-
Bug
-
Status: Closed
-
Minor - P4
-
Resolution: Fixed
-
3.3.0
-
None
-
Mongo Java driver 3.3.0, MongoDB 3.2.10 (localhost), Running in WebSphere 8.5.5.10, IBMJAVA7 7.0.9.40, Windows 7 Professional
Description
I see the following exceptions in my log file.
[11/14/16 15:55:22:187 CET] 00000b52 cluster I com.mongodb.diagnostics.logging.SLF4JLogger info Exception in monitor thread while connecting to server localhost:27017 |
java.lang.IllegalStateException: state should be: elapsed time is positive
|
at com.mongodb.assertions.Assertions.isTrue(Assertions.java:70) |
at com.mongodb.event.ServerHeartbeatSucceededEvent.<init>(ServerHeartbeatSucceededEvent.java:47) |
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:183) |
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:123) |
at java.lang.Thread.run(Thread.java:798) |
Code causing the exception:
class DefaultServerMonitor implements ServerMonitor { |
...
|
private ServerDescription lookupServerDescription(final InternalConnection connection) { |
...
|
long start = System.nanoTime(); |
try { |
BsonDocument isMasterResult = executeCommand("admin", new BsonDocument("ismaster", new BsonInt32(1)), connection); |
long elapsedTimeNanos = System.nanoTime() - start; |
averageRoundTripTime.addSample(elapsedTimeNanos);
|
|
serverMonitorListener.serverHeartbeatSucceeded(
|
new ServerHeartbeatSucceededEvent(connection.getDescription().getConnectionId(), isMasterResult, elapsedTimeNanos)); |
public ServerHeartbeatSucceededEvent(final ConnectionId connectionId, final BsonDocument reply, final long elapsedTimeNanos) { |
this.connectionId = notNull("connectionId", connectionId); |
this.reply = notNull("reply", reply); |
isTrue("elapsed time is positive", elapsedTimeNanos > 0); |
this.elapsedTimeNanos = elapsedTimeNanos; |
}
|
Could the elapsed time be '0' ?
Maybe the check should be "elapsedTimeNanos >= 0" ?
Attachments
Issue Links
- is depended on by
-
DRIVERS-336 Change "no maxStalenessSeconds" value from 0 to -1
-
- Closed
-
- is duplicated by
-
JAVA-2391 Change "no maxStalenessMS" value from 0 to -1
-
- Closed
-