Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Membase | Membase Server 1.6.x

Memcached dying on Mac OS X due to rlimit - fix

1 reply [Last post]
  • Login or register to post comments
Wed, 12/01/2010 - 12:52
quentinsf
Offline
Joined: 12/01/2010
Groups: None

 If you build on Mac OS X, you can get to a state where everything seems, from the web interface, to be running OK, but connections fail.

Looking at the log page, however, reveals that things are dying:

 Port server memcached on node 'ns_1@127.0.0.1' exited with status 71. Restarting. Messages: failed to set rlimit for open files. Try running as root or requesting smaller maxconns value.

Here's how I fixed it:

In both memcached/memcached.c (around line 6900) and moxi/memcached.c (around 4751) there's some code which tries to set the number of open connections using setrlimit(), based on the maxconns setting. The Mac doesn't like rlim_max being changed, and there's a limit of OPEN_MAX mentioned in the setrlimit man page.

I added:

 
#ifndef min 
   #define min(a,b) ((a) < (b) ? (a) : (b)) 
#endif 

at the top of each file and replaced the lines:

 
if (rlim.rlim_max < rlim.rlim_cur)
     rlim.rlim_max = rlim.rlim_cur; 

with

   rlim.rlim_cur = min(min(OPEN_MAX, rlim.rlim_max), rlim.rlim_cur);

And then did

make -C memcached
make -C moxi
make

And it all then worked.

This isn't an ideal solution, because it can ignore the maxconns configuration used internally, but it does get everything working.

Top
  • Login or register to post comments
Thu, 12/02/2010 - 13:42
perry
Offline
Joined: 10/11/2010
Groups:

Thanks for this information quentinsf...and thanks for filing the bug to handle it: http://jira.membase.org/browse/MB-3064

 

Perry

__________________

Forum support is great for free but sometimes you need a guaranteed response time and dedicated resources for your questions or issues.
Consider purchasing enterprise-level support from Couchbase: http://www.couchbase.com/products-and-services/overview
Call or email "sales -at- couchbase-dot- com" today!

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker