ErlyORM / boss_db

BossDB: a sharded, caching, pooling, evented ORM for Erlang
Other
277 stars 138 forks source link

MongoDB not closing connections #178

Closed choptastic closed 10 years ago

choptastic commented 10 years ago

From the mailing list (https://groups.google.com/forum/#!topic/chicagoboss/syF0zEKXCV8)

"I have noticed after upgrading that the actual version of CB/boss_db forgets to close mongodb connections. Just run 1000 queries and you will have 1000 active connections until timeout. Is it by purpose? The mongodb connection crashes heavily because of this (when running a lot of queries). going back to boss_db commit ad171d987d5df74932e79c9f8d9fce9640044206 solves the problem."

burbas commented 10 years ago

I've looked into this and found that it's the mongodb-module that's partially responsible for this error. The problem is that mongodb spawns (And links) a process to store values (https://github.com/ChicagoBoss/mongodb-erlang/blob/r16-compat/src/mvar.erl#L25). When the value is returned the process dies and boss_db_controller gets the signal and misinterpret it as a disconnection (https://github.com/ChicagoBoss/boss_db/blob/master/src/boss_db_controller.erl#L254).

One solution is to ignore normal exits but don't know the impact of the other adapters.

choptastic commented 10 years ago

Please try the latest version posted a few hours ago. It should be solved.

cloudtest commented 10 years ago

Thank you! It works like charm.

choptastic commented 10 years ago

Fabulous. Closed.