[JAVA-4750] Java Spring Reactive cannot connect to server Created: 05/Oct/22 Updated: 11/Oct/22 Resolved: 11/Oct/22 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Reactive Streams |
| Affects Version/s: | 4.0.0 |
| Fix Version/s: | None |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | Tanya C | Assignee: | Jeffrey Yemin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
I would like to get a confirmation and explanation of the root cause of this error below The Error from mongo : 1. Mongo Socket Error when Write Something went wrong org.springframework.dao.DataAccessResourceFailureException: Exception sending message; nested exception is }}com.mongodb.MongoSocketWriteException{{{}: Exception sending message at {} 2. Mongo Socket Error when Read 3. Follow by no Server chosen org.mongodb.driver.cluster : No server chosen by com.mongodb.reactivestreams.client.internal.ClientSessionHelper$$Lambda$0000/0x0000000840bf7440@3fcda9a9 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=xxx-dev-xxx-documentdb-0.xxxxxx-xxxxxx.docdb.amazonaws.com:27000, type=UNKNOWN, state=CONNECTING, exception= {com.mongodb.MongoSocketWriteException: Exception sending message}, caused by {io.netty.channel.StacklessClosedChannelException}}]}. Waiting for 30000 ms before timing out Is the root cause can be put as consumption below? and Solution to putting maxIdleTime is correct? Root caused : When the connection is idle for a period of time, the connection is closed due to firewall or load balancing, and the client does not know that, when the client continues to use this closed connection for reading and writing, an error will occur. If the root cause and solution correct? Is there another way we can see that the connection is lost? In the log, I only see the connection is Open |
| Comments |
| Comment by Jeffrey Yemin [ 11/Oct/22 ] |
|
tanya.chansataporn@gmail.com I'm going to close this now as it seems more like a support issue and not a problem with the driver itself. If you have further questions, please follow up on either:
Just in case you have already opened a support case and are not receiving sufficient help, please let me know and I can facilitate escalating your issue. Thank you! |
| Comment by Jeffrey Yemin [ 11/Oct/22 ] |
No. Generally you would need either logs from the actual process that closed the connection, or else Wireshark output
That would be a reasonable assumption. |
| Comment by Tanya C [ 11/Oct/22 ] |
|
Thank you Jeffrey for your reply I still have questions as below and added more logs as you requested. Question : Attached Kibana log: The Error appears on 14.29
Full-text Error : Refer similar ticket: https://jira.mongodb.org/browse/JAVA-4446 |
| Comment by Jeffrey Yemin [ 08/Oct/22 ] |
|
Load balancers and firewalls that close idle connections are one of many possible root causes of socket errors. With retryable reads and writes enabled in the driver (both are on by default), most operations will be automatically retried and the application will not receive any exceptions. If a socket error is followed by a server selection timeout error, that means that the retry mechanism failed for some other reason, probably unrelated to this sort of load balancer behavior. You should check server logs and confirm that a primary was actually available during the time period in question. From the looks of that server selection timeout error, the driver is unable to reach the replica set members (though it's hard to say for sure without the full exception message, which looks to be cut off in the description) |