# Does the DRB server need a Mutex lock?

**URL:** <https://www.ruby-forum.com/t/does-the-drb-server-need-a-mutex-lock/129244>\
**Category:** Ferret\
**Created:** [February 15, 2008, 6:46pm UTC](https://www.ruby-forum.com/t/does-the-drb-server-need-a-mutex-lock/129244 "2008-02-15T18:46:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndrake](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ba8739/32.png) [@ndrake](https://www.ruby-forum.com/u/ndrake)\
**Post date:** [February 15, 2008, 6:46pm UTC](https://www.ruby-forum.com/t/does-the-drb-server-need-a-mutex-lock/129244/1 "2008-02-15T18:46:29Z")

</div>

Recently we added more processor cores to the box that holds the  
acts\_as\_ferret drb server and now we are getting this fun:

Mysql::Error: Lost connection to MySQL server during query: SHOW TABLES

It happens in ferret\_server.rb’s method\_missing:

@logger.debug “#method\_missing(#{name.inspect}, #{args.inspect})”

I’m starting think we weren’t seeing this before because our system  
wasn’t trying to push multiple calls through the DRB server before  
because they were getting queued up at the OS level since we didn’t have  
enough processors to handle concurrent requests…

This would seem to resemble the database connection problem described  
here:

[http://wiki.rubyonrails.com/rails/pages/HowTosWorkerThreads](http://wiki.rubyonrails.com/rails/pages/HowTosWorkerThreads)

Maybe?

I don’t know much about DRB or this problem yet? But it may appear that  
a lock is needed around this thing so that multiple threads aren’t using  
the same database connection at the same time until some better thoughts  
have come up around making this search multi threaded?

Anyone agree with this assessment? From a cursory glance at DRB docs it  
seems DRB objects are multithreaded so its possible to have more than  
one thread walk through this thing at the same time…

---

<div class="post-metadata">

**Author:** ![ndrake](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ba8739/32.png) [@ndrake](https://www.ruby-forum.com/u/ndrake)\
**Post date:** [February 15, 2008, 8:22pm UTC](https://www.ruby-forum.com/t/does-the-drb-server-need-a-mutex-lock/129244/2 "2008-02-15T20:22:50Z")

</div>

Probably should be issuing that debug statement differently too or “SHOW  
TABLES” is going to get called a lot even for higher logging levels when  
the string is evaled?

if @logger.debug?  
@logger.debug “#method\_missing(#{name.inspect}, #{args.inspect})”  
end
