Quarkus: MongoClientConfig socketTimeout don't actually set a socket timeout

Created on 20 Mar 2020  路  6Comments  路  Source: quarkusio/quarkus

Describe the bug

Setting the property quarkus.mongodb.socket-timeout that translates to MongoClientConfig field Optional<Duration> socketTimeout have no effect whatsoever.

The socket configuration sets only the connection timeout but not the read timeout (this may hangs thread indefinitely).

See:

https://github.com/quarkusio/quarkus/blob/1.3.0.Final/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/AbstractMongoClientProducer.java#L198

https://mongodb.github.io/mongo-java-driver/3.12/javadoc/com/mongodb/connection/SocketSettings.Builder.html#readTimeout(int,java.util.concurrent.TimeUnit)

Expected behavior

Being able to set both connection and read timeout and use the configured values to actually configure the Mongo client socket settings.

Actual behavior

Socket timeout value not used, socket configuration partial:

https://github.com/quarkusio/quarkus/blob/1.3.0.Final/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/AbstractMongoClientProducer.java#L198

To Reproduce
Steps to reproduce the behavior:

  • Configure the client and lock the socket after connection
  • Simply search the codebase for socketTimeout

Configuration

quarkus.mongodb.socket-timeout
quarkus.mongodb.connect-timeout

Screenshots
Not related

Environment (please complete the following information):
Not related, every platform

Additional context
Tried to lock the socket after connection using a firewall and connection hangs in read wait indefinitely.

aremongodb kinbug

All 6 comments

/cc @loicmathieu

Thanks for reporting @filippobuletto!

I'll take a look

Blazing fast @geoand ! Hope this fix lands on 1.3.1 馃槃

Yeah, we will definitely add it. The only question is whether we will also rename the property or not (it was never having an effect , so it's debatable if it's a breaking change)

In fact, it's a nice dilemma, I could suggest keeping the name in 1.3.1 by fixing its behavior and deprecating its use, renaming it in 1.4.0?

In a totally selfish way I admit that I would like to have the fix published as soon as possible without waiting for a major release 馃槄

Edit: So far, thanks for incredible support!

Thanks for the input!

The fix will absolutely be in 1.3.1. The name of the property is to be determined 馃檭.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nderwin picture nderwin  路  3Comments

gastaldi picture gastaldi  路  3Comments

lbernardomaia picture lbernardomaia  路  3Comments

halhelal picture halhelal  路  3Comments

dansiviter picture dansiviter  路  3Comments