michaelklishin/monger — Issue #15: Out of semaphores to get db connection
Author: canassa
Created: 2012-02-27 22:50:48+00:00
State: open

I am writing a code that spawns ~200 threads and each thread performs a insert every ~2 seconds.

After a few minutes running I get this crash:

```
Caused by: java.util.concurrent.ExecutionException: com.mongodb.DBPortPool$SemaphoresOut: Out of semaphores to get db connection
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at clojure.core$future_call$reify__5684.deref(core.clj:6054)
at clojure.core$deref.invoke(core.clj:2078)
at legendas.core$cmap$step__1219$fn__1221.invoke(core.clj:93)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
```

I googled this error I found this stackoverflow thread:
http://stackoverflow.com/questions/6520439/how-to-configure-mongodb-java-driver-mongooptions-for-production-use

I seems that I need to increase the `threadsAllowedToBlockForConnectionMultiplier` but I am not sure how to do it in monger.

Thanks,
Cesar Canassa