I came across an issue while using version 2.19.2 and 2.19.3 with mongodb 3.6 in a setup with a primary and 2 replicas.
In write_worker.rb line 107 there is this bit of code session&.client.options[:retry_writes] which seems to have been thought to handle a nil session but not implemented completely as when the session is nil the client will be nil and will crash on accessing options. If I downgrade to 2.18.3 it's working fine as this bit of code isn't there.
Source: https://github.com/mongodb/mongo-ruby-driver/discussions/2811