The driver confuses order of replies from mongodb when several threads are used
Closed this issue · 3 comments
Pipeline subsystem assumes that all replies arrive in the same order the requests were sent.
In fact mongodb driver protocol provides responseTo field to reference the original request.
http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/
It means mongodb implementation reserves the right to reply in random order.
I just looked at this a little more closely and saw that Protocol.hs does verify the requestId and responseTo fields
It does, but if it doesn't match it throws an exception. At least it doesn't fail silently - this is good.
Reply from mongodb: the server has one thread per connection. As long as the requests come in via that same connection, then the ordering is indeed guaranteed. If more than one connection is used, the ordering is not guaranteed.