couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Joseph Davis (Commented) (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-1445) CouchDB deletes .view files if it can't open them, even if the error is "emfile".
Date Sun, 18 Mar 2012 22:54:40 GMT


Paul Joseph Davis commented on COUCHDB-1445:

Yep. This is a pretty good explanation and solution. This behavior has been there forever.
I always understood the intent to be what this ticket decided (rewriting views is fine, so
just trying to blow them away and rewriting to solve errors is acceptable). I agree that we
can switch this to a log and abort the open. The exact implementation of which can be in a
couple places but I'm not overly tied to any particular one.

One caveat, I'm pretty sure there's a function that works out to be the equivalent of strerror.
We should make use of that rather than trying to generate our own posix error messages.
> CouchDB deletes .view files if it can't open them, even if the error is "emfile".
> ---------------------------------------------------------------------------------
>                 Key: COUCHDB-1445
>                 URL:
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 1.2
>            Reporter: Jan Lehnardt
>            Assignee: Randall Leeds
>             Fix For: 1.2, 1.1.2
> Via Stefan Kögl on dev@:
> Another thing I noticed during my tests of CouchDB 1.2.x. I redirected
> live traffic to the instance and after a rather short time, requests
> were failing with the following information in the logs:
> [Sun, 18 Mar 2012 16:39:24 GMT] [error] [<0.27554.2>]
> {error_report,<0.31.0>,
>                                    {<0.27554.2>,std_error,
>                                     [{application,mochiweb},
>                                      "Accept failed error",
>                                      "{error,emfile}"]}}
> [Sun, 18 Mar 2012 16:39:24 GMT] [error] [<0.27554.2>]
> {error_report,<0.31.0>,
>                          {<0.27554.2>,crash_report,
>                           [[{initial_call,
>                                 {mochiweb_acceptor,init,
>                                     ['Argument__1','Argument__2',
>                                      'Argument__3']}},
>                             {pid,<0.27554.2>},
>                             {registered_name,[]},
>                             {error_info,
>                                 {exit,
>                                     {error,accept_failed},
>                                     [{mochiweb_acceptor,init,3},
>                                      {proc_lib,init_p_do_apply,3}]}},
>                             {ancestors,
>                                 [couch_httpd,couch_secondary_services,
>                                  couch_server_sup,<0.32.0>]},
>                             {messages,[]},
>                             {links,[<0.129.0>]},
>                             {dictionary,[]},
>                             {trap_exit,false},
>                             {status,running},
>                             {heap_size,233},
>                             {stack_size,24},
>                             {reductions,244}],
>                            []]}}
> I think "emfile" means that CouchDB (or mochiweb?) couldn't open any
> more files / connections. I've set the (hard and soft) nofile limit for
> user couchdb to 4096, but didn't raise the ERL_MAX_PORTS accordingly.
> Anyway, as soon as the error occured, CouchDB started writing most of my
> view files from scratch, rendering the instance unusable.
> I'd expect CouchDB to fail more gracefully when the maximum number of
> open files is reached. Is this a bug or expected behaviour?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message