Hi guys how are you today?
I am working on a playframework project using scala and mongoDB. We have 3 environments Dev, Demo, Production. The first one runs as a dedicated instance, and the others two are serverless (preview). We are encountering a problem that seems to only happen in Production and Demo and not on Dev (at least we could not reproduce on it).
The error we are getting:
2022-03-23 16:34:03,546[ERROR][services.g.GraphStudyService][scala-execution-context-global-913] - fetchStudiesForPatient: Exception while Getting the encounter for patient 150/ ...25c2d due to com.mongodb.MongoSocketReadException: Exception receiving message
at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:356)
at com.mongodb.internal.connection.tlschannel.impl.TlsChannelImpl.readFromChannel(TlsChannelImpl.java:357)
at com.mongodb.internal.connection.tlschannel.impl.TlsChannelImpl.readFromChannel(TlsChannelImpl.java:344)
at com.mongodb.internal.connection.tlschannel.impl.TlsChannelImpl.readAndUnwrap(TlsChannelImpl.java:629)
at com.mongodb.internal.connection.tlschannel.impl.TlsChannelImpl.read(TlsChannelImpl.java:236)
at com.mongodb.internal.connection.tlschannel.ClientTlsChannel.read(ClientTlsChannel.java:168)
at com.mongodb.internal.connection.tlschannel.async.AsynchronousTlsChannelGroup.readHandlingTasks(AsynchronousTlsChannelGroup.java:601)
at com.mongodb.internal.connection.tlschannel.async.AsynchronousTlsChannelGroup.doRead(AsynchronousTlsChannelGroup.java:566)
at com.mongodb.internal.connection.tlschannel.async.AsynchronousTlsChannelGroup.lambda$processRead$5(AsynchronousTlsChannelGroup.java:478)
... 3 common frames omitted
This happens the first time we try to query the mongoDB, then works fine and the same happens when you wait several minutes and try again to get some data from the DB. So we think that maybe the problem is because of the cold start of the severless instance maybe? Or maybe we need to configure something to mantain in some way the connectiona alive.
Please I really need a solution for this since as a said the problems occur in the client’s environment
Thank you in advance