Repository navigation
v5.1.1
mongo4s 5.1.1
Two fixes: a hang on large replies, which every runtime hits, and how kyo reports a cancellation. Binary compatible
with 5.0.0 and 5.1.0, checked by MiMa with no exclusions.
libraryDependencies += "org.mongo4s" %% "mongo4s-core" % "5.1.1"Bug fixes
- A large reply read in many small pieces hung the call. MongoDB driver
5.6.0to5.13.0nests one callback
per partial socket read of a reply and unwinds them all at once when the reply is complete. About 900 reads
overflow the stack of the driver's I/O thread. TheStackOverflowErrornever reaches the caller, so thefind
waits forever (JAVA-6313). A link that delivers a few kilobytes per
read is enough to trigger it: TLS does, and so does Docker Desktop'shost.docker.internal, where a 3.5 MB reply
took over 1,500 reads. mongo4s now depends on driver5.14.0, which reads in a loop instead. - On kyo,
guaranteeCaseandbracketCasereported a cancellation as an error. kyo1.0.0-RC7abandons a fiber
interrupted while it waits and closes its scope withKyoException("fiber abandoned"). The finalizer therefore saw
ExitCase.Erroredinstead ofExitCase.Canceled. Transactions still rolled back, but code that tells the two cases
apart counted every timeout as a failure. The finalizer now seesCanceled.
Dependencies
mongodb-driver-reactivestreams,mongodb-driver-coreandbson5.14.0. A build that pins its ownorg.mongodb
jars needs5.14.0or later, or it still hangs.
Build
LargeReplyItSpecreads a 3 MB batch through a proxy that passes the server's answer on a kilobyte at a time. On
5.13.0it times out with the overflow in the log; on5.14.0it passes.cats,zioandkyoeach have a spec that interrupts a body insideguaranteeCase; none did before.