You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Barry Wark <ba...@gmail.com> on 2012/11/07 20:17:22 UTC

Server termination ({badmatch,{error,emfile}})

I'm seeing couchdb errors (in couchdb.log) like the following. The errors
occur while running a Java test suite that connects to CouchDB via the
Ektorp library. Most attempts work fine, but we see failures like the
following in approximately one of 500 connection attempts. I'm attaching
the local.ini file, in case that provides relevant information.

As expected, the server comes back up after a few seconds, but I'm
wondering if this is symptomatic of an issue in (1) our code or (2)
couchdb. We're running CouchDB 1.2.0 via the couchdbx-core distribution
from the CouchDB Server.app.

Thanks!

Barry

[Wed, 07 Nov 2012 18:46:53 GMT] [error] [<0.154.0>] ** Generic server
<0.154.0> terminating
** Last message in was delayed_commit
** When Server state == {db,<0.153.0>,<0.154.0>,nil,<<"1352313746773254">>,
                            <0.155.0>,<0.151.0>,<0.157.0>,
                            {db_header,6,4909,0,
                                {22187538,{4908,0,671752},572143},
                                {22189969,4908,490610},
                                nil,0,nil,79,1000},
                            4909,
                            {btree,<0.151.0>,
                                {22194489,{4909,0,671888},572222},
                                #Fun<couch_db_updater.10.54616312>,
                                #Fun<couch_db_updater.11.54616312>,
                                #Fun<couch_btree.5.62781489>,
                                #Fun<couch_db_updater.12.54616312>,snappy},
                            {btree,<0.151.0>,
                                {22196504,4909,490695},
                                #Fun<couch_db_updater.13.54616312>,
                                #Fun<couch_db_updater.14.54616312>,
                                #Fun<couch_btree.5.62781489>,
                                #Fun<couch_db_updater.15.54616312>,snappy},
                            {btree,<0.151.0>,nil,
                                #Fun<couch_btree.3.62781489>,
                                #Fun<couch_btree.4.62781489>,
                                #Fun<couch_btree.5.62781489>,nil,snappy},
                            4910,

<<"ovation-518b9006f0e768276c2b36df72ae92d371c73701e99c5d5b3e9e6cd2198ce32a">>,

"var/lib/couchdb/ovation-518b9006f0e768276c2b36df72ae92d371c73701e99c5d5b3e9e6cd2198ce32a.couch",
                            [],
                            [{<<"readers">>,
                              {[{<<"names">>,[<<"barry">>]},
                                {<<"roles">>,[]}]}},
                             {<<"admins">>,
                              {[{<<"names">>,[<<"barry">>]},
                                {<<"roles">>,[]}]}}],
                            79,
                            {user_ctx,null,[],undefined},
                            #Ref<0.0.0.143882>,1000,
                            [before_header,after_header,on_file_open],
                            [{user_ctx,
                                 {user_ctx,<<"barry">>,
                                     [<<"_admin">>],
                                     <<"{couch_httpd_auth,
default_authentication_handler}">>}}],
                            snappy,nil,nil}
** Reason for termination ==
** {{badmatch,{error,emfile}},
    [{couch_file,sync,1,

 [{file,"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_file.erl"},
                  {line,187}]},
     {couch_db_updater,commit_data,2,

 [{file,"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                        {line,797}]},
     {couch_db_updater,handle_info,2,

 [{file,"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                        {line,257}]},
     {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,597}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}

[Wed, 07 Nov 2012 18:46:53 GMT] [error] [<0.154.0>] {error_report,<0.30.0>,
                     {<0.154.0>,crash_report,

[[{initial_call,{couch_db_updater,init,['Argument__1']}},
                        {pid,<0.154.0>},
                        {registered_name,[]},
                        {error_info,
                         {exit,
                          {{badmatch,{error,emfile}},
                           [{couch_file,sync,1,
                             [{file,

 "/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_file.erl"},
                              {line,187}]},
                            {couch_db_updater,commit_data,2,
                             [{file,

 "/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                              {line,797}]},
                            {couch_db_updater,handle_info,2,
                             [{file,

 "/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                              {line,257}]},
                            {gen_server,handle_msg,5,
                             [{file,"gen_server.erl"},{line,597}]},
                            {proc_lib,init_p_do_apply,3,
                             [{file,"proc_lib.erl"},{line,227}]}]},
                          [{gen_server,terminate,6,
                            [{file,"gen_server.erl"},{line,737}]},
                           {proc_lib,init_p_do_apply,3,
                            [{file,"proc_lib.erl"},{line,227}]}]}},
                        {ancestors,[<0.153.0>,<0.150.0>]},
                        {messages,[]},
                        {links,[<0.153.0>]},
                        {dictionary,[]},
                        {trap_exit,true},
                        {status,running},
                        {heap_size,2584},
                        {stack_size,24},
                        {reductions,1461560}],
                       []]}}
[Wed, 07 Nov 2012 18:46:53 GMT] [error] [<0.153.0>] ** Generic server
<0.153.0> terminating
** Last message in was {'EXIT',<0.154.0>,
                           {{badmatch,{error,emfile}},
                            [{couch_file,sync,1,
                                 [{file,

"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_file.erl"},
                                  {line,187}]},
                             {couch_db_updater,commit_data,2,
                                 [{file,

"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                                  {line,797}]},
                             {couch_db_updater,handle_info,2,
                                 [{file,

"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                                  {line,257}]},
                             {gen_server,handle_msg,5,
                                 [{file,"gen_server.erl"},{line,597}]},
                             {proc_lib,init_p_do_apply,3,
                                 [{file,"proc_lib.erl"},{line,227}]}]}}
** When Server state == {db,<0.153.0>,<0.154.0>,nil,<<"1352313746773254">>,
                            <0.155.0>,<0.151.0>,<0.157.0>,
                            {db_header,6,4909,0,
                                {22187538,{4908,0,671752},572143},
                                {22189969,4908,490610},
                                nil,0,nil,79,1000},
                            4909,
                            {btree,<0.151.0>,
                                {22194489,{4909,0,671888},572222},
                                #Fun<couch_db_updater.10.54616312>,
                                #Fun<couch_db_updater.11.54616312>,
                                #Fun<couch_btree.5.62781489>,
                                #Fun<couch_db_updater.12.54616312>,snappy},
                            {btree,<0.151.0>,
                                {22196504,4909,490695},
                                #Fun<couch_db_updater.13.54616312>,
                                #Fun<couch_db_updater.14.54616312>,
                                #Fun<couch_btree.5.62781489>,
                                #Fun<couch_db_updater.15.54616312>,snappy},
                            {btree,<0.151.0>,nil,
                                #Fun<couch_btree.3.62781489>,
                                #Fun<couch_btree.4.62781489>,
                                #Fun<couch_btree.5.62781489>,nil,snappy},
                            4910,

<<"ovation-518b9006f0e768276c2b36df72ae92d371c73701e99c5d5b3e9e6cd2198ce32a">>,

"var/lib/couchdb/ovation-518b9006f0e768276c2b36df72ae92d371c73701e99c5d5b3e9e6cd2198ce32a.couch",
                            [],
                            [{<<"readers">>,
                              {[{<<"names">>,[<<"barry">>]},
                                {<<"roles">>,[]}]}},
                             {<<"admins">>,
                              {[{<<"names">>,[<<"barry">>]},
                                {<<"roles">>,[]}]}}],
                            79,
                            {user_ctx,null,[],undefined},
                            #Ref<0.0.0.143882>,1000,
                            [before_header,after_header,on_file_open],
                            [{user_ctx,
                                 {user_ctx,<<"barry">>,
                                     [<<"_admin">>],
                                     <<"{couch_httpd_auth,
default_authentication_handler}">>}}],
                            snappy,nil,nil}
** Reason for termination ==
** {{badmatch,{error,emfile}},
    [{couch_file,sync,1,

 [{file,"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_file.erl"},
                  {line,187}]},
     {couch_db_updater,commit_data,2,

 [{file,"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                        {line,797}]},
     {couch_db_updater,handle_info,2,

 [{file,"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                        {line,257}]},
     {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,597}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}

[Wed, 07 Nov 2012 18:46:53 GMT] [error] [<0.153.0>] {error_report,<0.30.0>,
                     {<0.153.0>,crash_report,
                      [[{initial_call,{couch_db,init,['Argument__1']}},
                        {pid,<0.153.0>},
                        {registered_name,[]},
                        {error_info,
                         {exit,
                          {{badmatch,{error,emfile}},
                           [{couch_file,sync,1,
                             [{file,

 "/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_file.erl"},
                              {line,187}]},
                            {couch_db_updater,commit_data,2,
                             [{file,

 "/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                              {line,797}]},
                            {couch_db_updater,handle_info,2,
                             [{file,

 "/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                              {line,257}]},
                            {gen_server,handle_msg,5,
                             [{file,"gen_server.erl"},{line,597}]},
                            {proc_lib,init_p_do_apply,3,
                             [{file,"proc_lib.erl"},{line,227}]}]},
                          [{gen_server,terminate,6,
                            [{file,"gen_server.erl"},{line,737}]},
                           {proc_lib,init_p_do_apply,3,
                            [{file,"proc_lib.erl"},{line,227}]}]}},
                        {ancestors,[<0.150.0>]},
                        {messages,[]},
                        {links,[<0.86.0>]},
                        {dictionary,[]},
                        {trap_exit,true},
                        {status,running},
                        {heap_size,4181},
                        {stack_size,24},
                        {reductions,100566}],
                       []]}}
[Wed, 07 Nov 2012 18:46:53 GMT] [info] [<0.162.0>] Shutting down view group
server, monitored db is closing.
[Wed, 07 Nov 2012 18:46:53 GMT] [error] [<0.86.0>] Unexpected message,
restarting couch_server: {'EXIT',
                                                                 <0.153.0>,
                                                                 {{badmatch,
                                                                   {error,

emfile}},

[{couch_file,
                                                                    sync,1,
                                                                    [{file,

"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_file.erl"},
                                                                     {line,

187}]},

 {couch_db_updater,

commit_data,
                                                                    2,
                                                                    [{file,

"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                                                                     {line,

797}]},

 {couch_db_updater,

handle_info,
                                                                    2,
                                                                    [{file,

"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                                                                     {line,

257}]},

 {gen_server,

handle_msg,
                                                                    5,
                                                                    [{file,

"gen_server.erl"},
                                                                     {line,

597}]},

 {proc_lib,

init_p_do_apply,
                                                                    3,
                                                                    [{file,

"proc_lib.erl"},
                                                                     {line,

227}]}]}}
[Wed, 07 Nov 2012 18:46:53 GMT] [error] [<0.86.0>] ** Generic server
couch_server terminating
** Last message in was {'EXIT',<0.153.0>,
                           {{badmatch,{error,emfile}},
                            [{couch_file,sync,1,
                                 [{file,

"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_file.erl"},
                                  {line,187}]},
                             {couch_db_updater,commit_data,2,
                                 [{file,

"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                                  {line,797}]},
                             {couch_db_updater,handle_info,2,
                                 [{file,

"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_db_updater.erl"},
                                  {line,257}]},
                             {gen_server,handle_msg,5,
                                 [{file,"gen_server.erl"},{line,597}]},
                             {proc_lib,init_p_do_apply,3,
                                 [{file,"proc_lib.erl"},{line,227}]}]}}
** When Server state == {server,"var/lib/couchdb",
                            {re_pattern,0,0,

<<69,82,67,80,124,0,0,0,16,0,0,0,1,0,0,0,0,0,

0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,0,0,93,0,72,25,77,0,0,0,0,0,0,

0,0,0,0,0,0,254,255,255,7,0,0,0,0,0,0,0,0,0,

0,0,0,0,0,0,0,77,0,0,0,0,16,171,255,3,0,0,0,

128,254,255,255,7,0,0,0,0,0,0,0,0,0,0,0,0,0,
                                  0,0,0,69,26,84,0,72,0>>},
                            100,1,"Wed, 07 Nov 2012 18:42:26 GMT"}
** Reason for termination ==
** kill

[Wed, 07 Nov 2012 18:46:53 GMT] [error] [<0.86.0>] {error_report,<0.30.0>,
                    {<0.86.0>,crash_report,
                     [[{initial_call,{couch_server,init,['Argument__1']}},
                       {pid,<0.86.0>},
                       {registered_name,couch_server},
                       {error_info,
                        {exit,kill,
                         [{gen_server,terminate,6,
                           [{file,"gen_server.erl"},{line,737}]},
                          {proc_lib,init_p_do_apply,3,
                           [{file,"proc_lib.erl"},{line,227}]}]}},
                       {ancestors,
                        [couch_primary_services,couch_server_sup,<0.31.0>]},
                       {messages,
                        [{'$gen_call',
                          {<0.96.0>,#Ref<0.0.0.143989>},
                          {open,<<"_users">>,
                           [{before_doc_update,
                             #Fun<couch_users_db.before_doc_update.2>},
                            {after_doc_read,
                             #Fun<couch_users_db.after_doc_read.2>},
                            sys_db,
                            {user_ctx,
                             {user_ctx,null,[<<"_admin">>],undefined}},
                            sys_db]}}]},
                       {links,[<0.83.0>]},
                       {dictionary,[]},
                       {trap_exit,true},
                       {status,running},
                       {heap_size,4181},
                       {stack_size,24},
                       {reductions,212008}],
                      []]}}
[Wed, 07 Nov 2012 18:46:53 GMT] [error] [<0.83.0>] {error_report,<0.30.0>,
                       {<0.83.0>,supervisor_report,
                        [{supervisor,{local,couch_primary_services}},
                         {errorContext,child_terminated},
                         {reason,kill},
                         {offender,
                             [{pid,<0.86.0>},
                              {name,couch_server},
                              {mfargs,{couch_server,sup_start_link,[]}},
                              {restart_type,permanent},
                              {shutdown,brutal_kill},
                              {child_type,worker}]}]}}
[Wed, 07 Nov 2012 18:46:53 GMT] [error] [<0.96.0>] ** Generic server
couch_auth_cache terminating
** Last message in was {'DOWN',#Ref<0.0.0.128>,process,<0.100.0>,shutdown}
** When Server state == {state,50,1,<0.97.0>,#Ref<0.0.0.128>}
** Reason for termination ==
** {kill,
       {gen_server,call,
           [couch_server,
            {open,<<"_users">>,

[{before_doc_update,#Fun<couch_users_db.before_doc_update.2>},
                 {after_doc_read,#Fun<couch_users_db.after_doc_read.2>},
                 sys_db,
                 {user_ctx,{user_ctx,null,[<<"_admin">>],undefined}},
                 sys_db]},
            infinity]}}

[Wed, 07 Nov 2012 18:46:53 GMT] [error] [<0.96.0>] {error_report,<0.30.0>,
                    {<0.96.0>,crash_report,

 [[{initial_call,{couch_auth_cache,init,['Argument__1']}},
                       {pid,<0.96.0>},
                       {registered_name,couch_auth_cache},
                       {error_info,
                        {exit,
                         {kill,
                          {gen_server,call,
                           [couch_server,
                            {open,<<"_users">>,
                             [{before_doc_update,
                               #Fun<couch_users_db.before_doc_update.2>},
                              {after_doc_read,
                               #Fun<couch_users_db.after_doc_read.2>},
                              sys_db,
                              {user_ctx,
                               {user_ctx,null,[<<"_admin">>],undefined}},
                              sys_db]},
                            infinity]}},
                         [{gen_server,terminate,6,
                           [{file,"gen_server.erl"},{line,737}]},
                          {proc_lib,init_p_do_apply,3,
                           [{file,"proc_lib.erl"},{line,227}]}]}},
                       {ancestors,

[couch_secondary_services,couch_server_sup,<0.31.0>]},
                       {messages,[{'EXIT',<0.97.0>,normal}]},
                       {links,[<0.94.0>]},
                       {dictionary,[]},
                       {trap_exit,true},
                       {status,running},
                       {heap_size,2584},
                       {stack_size,24},
                       {reductions,43957}],
                      []]}}
[Wed, 07 Nov 2012 18:46:53 GMT] [error] [<0.94.0>] {error_report,<0.30.0>,
                    {<0.94.0>,supervisor_report,
                     [{supervisor,{local,couch_secondary_services}},
                      {errorContext,child_terminated},
                      {reason,
                       {kill,
                        {gen_server,call,
                         [couch_server,
                          {open,<<"_users">>,
                           [{before_doc_update,
                             #Fun<couch_users_db.before_doc_update.2>},
                            {after_doc_read,
                             #Fun<couch_users_db.after_doc_read.2>},
                            sys_db,
                            {user_ctx,
                             {user_ctx,null,[<<"_admin">>],undefined}},
                            sys_db]},
                          infinity]}}},
                      {offender,
                       [{pid,<0.96.0>},
                        {name,auth_cache},
                        {mfargs,{couch_auth_cache,start_link,[]}},
                        {restart_type,permanent},
                        {shutdown,brutal_kill},
                        {child_type,worker}]}]}}