CouchDB
  1. CouchDB
  2. COUCHDB-1792

Query to a view fails with {os_process_error,{exit_status,1}}

    Details

    • Skill Level:
      Guru Level (Everyone buy this person a beer at the next conference!)

      Description

      I have a heavy JSON document around 5MB in size. I installed couchdb 1.3, spidermonkey 1.8.5 from source on a unix box. Upon querying a view having this heavy document I get the following error intermittently (once in a 2 queries)

      The same operations never fails on my windows box but does fail sometimes on this unix installation which built from source.

      Stacktrace:
      [Fri, 10 May 2013 22:35:52 GMT] [error] [<0.187.0>] OS Process Error <0.189.0> :: {os_process_error,{exit_status,1}}
      [Fri, 10 May 2013 22:35:52 GMT] [error] [emulator] Error in process <0.187.0> with exit value: {{nocatch,{os_process_error,

      {exit_status,1}

      }},[

      {couch_os_process,prompt,2 }

      ,

      {couch_query_servers,map_doc_raw,2}

      ,

      {couch_mrview_updater,'-map_docs/2-fun-0-',3}

      ,

      {lists,foldl,3}

      ,

      {couch_mrview_updater,map_docs,2}

      ]}

      [Fri, 10 May 2013 22:35:52 GMT] [debug] [<0.108.0>] Minor error in HTTP request: {os_process_error,{exit_status,1}}
      [Fri, 10 May 2013 22:35:52 GMT] [debug] [<0.108.0>] Stacktrace: [

      {couch_mrview_util,get_view,4}

      ,

      {couch_mrview,query_view,6}

      ,

      {couch_httpd,etag_maybe,2}

      ,

      {couch_mrview_http,design_doc_view,5}

      ,

      {couch_httpd_db,do_db_req,2}

      ,

      {couch_httpd,handle_request_int,5}

      ,

      {mochiweb_http,headers,5}

      ,

      {proc_lib,init_p_do_apply,3}

      ]
      [Fri, 10 May 2013 22:35:52 GMT] [info] [<0.108.0>] 10.36.3.4 - - GET /config-store-test/_design/queries/_view/docsByName?key=%22Arpit10%22&include_docs=true 500
      [Fri, 10 May 2013 22:35:52 GMT] [error] [<0.108.0>] httpd 500 error response:

        Issue Links

          Activity

          Hide
          Robert Newson added a comment -

          try;

          curl -XPUT localhost:5984/_config/couchdb/os_process_timeout -d '"60000"'

          and see if that helps.

          Show
          Robert Newson added a comment - try; curl -XPUT localhost:5984/_config/couchdb/os_process_timeout -d '"60000"' and see if that helps.
          Hide
          Arpit added a comment -

          Increasing timeout didnt help. Its actually going OOM. Is there a way to increase process memory ?

          stderr:

          heart_beat_kill_pid = 21968
          heart_beat_timeout = 11
          out of memory
          Failed to execute script.
          heart: Sat May 11 17:24:48 2013: Erlang has closed.
          heart: Sat May 11 17:24:49 2013: Executed "/bin/couchdb -k". Terminating.

          heart_beat_kill_pid = 5337
          heart_beat_timeout = 11
          out of memory
          SyntaxError: JSON.parse
          Stacktrace:
          ()@/usr/share/couchdb/server/main.js:1544
          @/usr/share/couchdb/server/main.js:1561

          Show
          Arpit added a comment - Increasing timeout didnt help. Its actually going OOM. Is there a way to increase process memory ? stderr: heart_beat_kill_pid = 21968 heart_beat_timeout = 11 out of memory Failed to execute script. heart: Sat May 11 17:24:48 2013: Erlang has closed. heart: Sat May 11 17:24:49 2013: Executed "/bin/couchdb -k". Terminating. heart_beat_kill_pid = 5337 heart_beat_timeout = 11 out of memory SyntaxError: JSON.parse Stacktrace: ()@/usr/share/couchdb/server/main.js:1544 @/usr/share/couchdb/server/main.js:1561
          Hide
          Randall Leeds added a comment -

          Turns out we were doing the wrong thing with the -S option to couchjs. I'm attaching a patch which fixes this. Should we also change the wording and/or the short/long option for couchjs?

          Show
          Randall Leeds added a comment - Turns out we were doing the wrong thing with the -S option to couchjs. I'm attaching a patch which fixes this. Should we also change the wording and/or the short/long option for couchjs?
          Hide
          Arpit added a comment -

          This issue was resolved after applying the patch and increasing the stack size using the -S option. Thanks

          Show
          Arpit added a comment - This issue was resolved after applying the patch and increasing the stack size using the -S option. Thanks
          Hide
          Robert Newson added a comment -

          +1, nice one Randall.

          Show
          Robert Newson added a comment - +1, nice one Randall.
          Hide
          ASF subversion and git services added a comment -

          Commit 501459c8b70efb814f5eef131201f7954781af1d in branch refs/heads/master from Randall Leeds <randall@apache.org>
          [ https://git-wip-us.apache.org/repos/asf?p=couchdb.git;h=501459c ]

          [couchjs] make stack size option effective

          The previous way this was coded changes the chunk size that is used
          whenever the stack grows but does not change the maximum memory
          allowed by the runtime.

          Closes COUCHDB-1792

          Show
          ASF subversion and git services added a comment - Commit 501459c8b70efb814f5eef131201f7954781af1d in branch refs/heads/master from Randall Leeds <randall@apache.org> [ https://git-wip-us.apache.org/repos/asf?p=couchdb.git;h=501459c ] [couchjs] make stack size option effective The previous way this was coded changes the chunk size that is used whenever the stack grows but does not change the maximum memory allowed by the runtime. Closes COUCHDB-1792
          Hide
          ASF subversion and git services added a comment -

          Commit cfaa66cd6f5590bc317cf063112bb27e23ee06d8 in branch refs/heads/1.3.x from Randall Leeds <randall@apache.org>
          [ https://git-wip-us.apache.org/repos/asf?p=couchdb.git;h=cfaa66c ]

          [couchjs] make stack size option effective

          The previous way this was coded changes the chunk size that is used
          whenever the stack grows but does not change the maximum memory
          allowed by the runtime.

          Closes COUCHDB-1792

          Show
          ASF subversion and git services added a comment - Commit cfaa66cd6f5590bc317cf063112bb27e23ee06d8 in branch refs/heads/1.3.x from Randall Leeds <randall@apache.org> [ https://git-wip-us.apache.org/repos/asf?p=couchdb.git;h=cfaa66c ] [couchjs] make stack size option effective The previous way this was coded changes the chunk size that is used whenever the stack grows but does not change the maximum memory allowed by the runtime. Closes COUCHDB-1792
          Hide
          Dave Cottlehuber added a comment -

          its unclear what `-S ...` actually does for the view server. We need at least to clarify this in docs & couchjs -h message

          Show
          Dave Cottlehuber added a comment - its unclear what `-S ...` actually does for the view server. We need at least to clarify this in docs & couchjs -h message
          Hide
          Randall Leeds added a comment -

          It says it in the help: "specify that the runtime should allow at most SIZE bytes of memory to be allocated". Maybe we should note the default? It's 64MB.

          Show
          Randall Leeds added a comment - It says it in the help: "specify that the runtime should allow at most SIZE bytes of memory to be allocated". Maybe we should note the default? It's 64MB.
          Hide
          Dave Cottlehuber added a comment -

          Randall Leeds I'd like to add something in the docs that says see this, try that. So what does that actually mean for a user? Does this mean there's an effective upper bound on JSON doc parsing, or a single object (e.g. really long string), due to the maximum size allocation? Is this a simple way of ensuring a runaway couchjs process doesn't consume all RAM?

          Show
          Dave Cottlehuber added a comment - Randall Leeds I'd like to add something in the docs that says see this, try that. So what does that actually mean for a user? Does this mean there's an effective upper bound on JSON doc parsing, or a single object (e.g. really long string), due to the maximum size allocation? Is this a simple way of ensuring a runaway couchjs process doesn't consume all RAM?
          Hide
          ASF GitHub Bot added a comment -

          Github user jaydoane commented on the issue:

          https://github.com/apache/couchdb-couch/pull/216

          +1

          Though it's curious how the previous fix https://issues.apache.org/jira/browse/COUCHDB-1792 was apparently never applied. However, it clearly seems to be the right thing to do.

          Show
          ASF GitHub Bot added a comment - Github user jaydoane commented on the issue: https://github.com/apache/couchdb-couch/pull/216 +1 Though it's curious how the previous fix https://issues.apache.org/jira/browse/COUCHDB-1792 was apparently never applied. However, it clearly seems to be the right thing to do.

            People

            • Assignee:
              Dave Cottlehuber
              Reporter:
              Arpit
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:

                Development