Ying, Looks like your error is EMFILE, meaning too many open files as returned by the operating system.
On OSX it appears you can up the limit: http://stackoverflow.com/questions/5377450/maximum-number-of-open-filehandles-per-process-on-osx-and-how-to-increase Try the command(s) listed there and see if this fixes your problem. Good luck, Joan ----- Original Message ----- > From: "Ying Bian" <[email protected]> > To: [email protected] > Sent: Wednesday, June 29, 2016 6:09:11 PM > Subject: Need help on this "badmatch" error of couchdb 2.0 > > Hi, > > I'm developing a web application using couchdb 2.0 dev build (version > is '9d28c57' at this time) as the database. Sometimes when I do a > simple query against a simple view using pouchdb api, I got the > following error emitted by couchdb (I've tried to prettify the > output by replacing '\n' with hard newline). When the error happens, > if I wait for a few minutes and try again, it may work again. But > this is definitely something that I need to worry about as it looks > like something fundamental with couchdb. > > This happens in my local Mac machine. The only special thing about my > setup is that there are about 70+ small databases created, but my > query is against only one of those. Let me know if you have any > idea. I can upgrade to the latest build if you think that may help, > but I doubt that as I upgraded several times before but things did > not change. > > The error stack: > > {"status":500,"name":"badmatch","message":"Database encountered an > unknown > error","reason":"{error,{badmatch,{error,{{badmatch,{error,emfile}}, > [{couch_file,init,1, > [{file,\"src/couch_file.erl\"},{line,336}]}, > {gen_server,init_it,6, > [{file,\"gen_server.erl\"},{line,328}]}, > {proc_lib,init_p_do_apply,3, > [{file,\"proc_lib.erl\"},{line,240}]}]}}, > [{couch_index_server,get_index,4, > [{file,\"src/couch_index_server.erl\"}, > {line,97}]}, > {couch_mrview_util,get_view,4, > [{file,\"src/couch_mrview_util.erl\"}, > {line,47}]}, > {couch_mrview,query_view,6, > [{file,\"src/couch_mrview.erl\"},{line,244}]}, > {rexi_server,init_p,3, > [{file,\"src/rexi_server.erl\"},{line,139}]}]}}"} > > -Ying
