[JAVA-3103] Do not monitor the arbiters Created: 27/Nov/18  Updated: 27/Oct/23  Resolved: 06/Dec/18

Status: Closed
Project: Java Driver
Component/s: Cluster Management
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Rustam Abdullaev Assignee: Jeffrey Yemin
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible

 Description   

In cluster mode, the driver monitors all hosts - actives, passives and arbiters.

In fact it is not necessary to monitor the arbiters since the driver never connects to them.

 

In our infra, the arbiters are firewalled and so we always get these messages:

Exception in monitor thread while connecting to server arbiterhost:27025com.mongodb.MongoSocketOpenException: Exception opening socket
       at com.mongodb.connection.SocketStream.open(SocketStream.java:62)
       at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:126)
       at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:114)
       at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketTimeoutException: connect timed out
       at java.net.PlainSocketImpl.socketConnect(Native Method)
       at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
       at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
       at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
       at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
       at java.net.Socket.connect(Socket.java:589)
       at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:59)
       at com.mongodb.connection.SocketStream.open(SocketStream.java:57)
 

 

The solution I think is to remove addNewHosts(description.getArbiters()) from MultiServerCluster.ensureServers()

 



 Comments   
Comment by Rustam Abdullaev [ 06/Dec/18 ]

Clear thank you. Yes I get the warning only once.

Comment by Jeffrey Yemin [ 03/Dec/18 ]

Hi rustyx,

This behavior is intentional. The Java driver is abiding by the Server Discovery and Monitoring specification, which requires drivers to monitor arbiters.  The rationale is in this section.

Your choice here is to either live with the log message (and please confirm that you see it only once at startup, and not repeatedly), or to remove the firewall rule.

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