The full environment is as follows:
MongoDB 1.8.2 in a replica set config with 2 machines and one arb.
A threaded ruby app using JRuby 1.6.4 and connecting to mongo with the 1.4 driver.
When receiving a high load, the app starts getting occasionally a Mongo::ConnectionFailureError in some threads, then at some point every remaining thread hangs up with a ConnectionFailureError, and then the app is deadlocked. No further request can continue and the app has to be completely restarted.
A thread dump reveals a lot of threads waiting on synchronize_do blocks. This can be reproduced with enough last. Incrementing the pool size seems only to delay the problem, but not fix it.
This is a problem with both the 1.4.0 and 1.4.1 versions, in a live environment and in a test system. The 1.3.1 driver does not have this problem.