iriscouch / couchjs

Drop-in replacement JavaScript engine for Apache CouchDB
Apache License 2.0
90 stars 13 forks source link

OS process timed out. #3

Open mikeal opened 11 years ago

mikeal commented 11 years ago

I can't seem to get this working.

I'm on SmartOS. Keep getting this all over my couch log:

[Thu, 20 Jun 2013 18:21:21 GMT] [error] [<0.867.0>] OS Process Error <0.891.0> :: {os_process_error, "OS process timed out."} [Thu, 20 Jun 2013 18:21:25 GMT] [error] [<0.842.0>] OS Process Error <0.897.0> :: {os_process_error, "OS process timed out."}

carpogoryanin commented 10 years ago

Hello. I have the same problem on Ubuntu 14.04 (node.js 0.10.29). Top shows that processes with couchjs are restarting all the time, when I try run some view. May be exist some solutions? I find nothing about this in google. Thanks.

jhs commented 10 years ago

Thanks. Does the test suite run?

carpogoryanin commented 10 years ago

Test output (test/experiment.js):

Hit SIGUSR1 - starting debugger agent.
debugger listening on port 5859
Doing stuff: 0
More stuff: 0
Test vm
Run vm now
Result:
{ _idleTimeout: 1000,
  _idlePrev: 
   { _idleNext: [Circular],
     _idlePrev: [Circular],
     msecs: 1000,
     ontimeout: [Function: listOnTimeout] },
  _idleNext: 
   { _idleNext: [Circular],
     _idlePrev: [Circular],
     msecs: 1000,
     ontimeout: [Function: listOnTimeout] },
  _when: 1406737367189,
  _onTimeout: [Function: hello],
  _idleStart: 1406737366190 }
Hello: 10
Hello: 9
Hello: 8
Hello: 7
Hello: 6
Hello: 5
Hello: 4
Hello: 3
Hello: 2
Hello: 1
JKDingwall commented 9 years ago

In cli.js I added (a move will probably do)

process.stdin.resume()

at line 60 such that block of code looks like:

process.stdin.resume()
process.stdin.setEncoding('utf8')
process.stdin.pipe(stdin)
process.stdin.resume()

The clue was in creating the log file in /tmp (touch /tmp/couchjs.log) which collected a message similar to "Error: Cannot switch to old mode now."

jhs commented 9 years ago

Oh, thanks!

jhs commented 9 years ago

@JKDingwall I am not 100% sure I see where you added that code? Would you mind making a PR, or just a link to the source you are referring to would be sufficient.

I am looking at line 60 here: https://github.com/iriscouch/couchjs/blob/master/cli.js#L60

(Another problem that I often have is that I push lots of code to GitHub and forget to npm publish. Might that be it?)

JKDingwall commented 9 years ago

From my npm install -g couchjs I seem to have got a version of cli.js at 5a438debb0a8aec7ed67dd52c751623247651cda but that does not include process.stdin.resume() at all so I'm not sure where that came from. I will try an install of couchjs with npm install <git:// url> and report my experiences against that.

jhs commented 9 years ago

Thank you very much. I am eager to hear your results.

brailateo commented 8 years ago

The same error for me, I did a fresh

sudo npm -g install git://github.com/iriscouch/couchjs

on a Linux machine, Ubuntu 15.10 with CouchDB 1.6.0, got another cli.js without resume() at line 62 but nodejs views are still crashing the server:

root@teo-Home:/var/log/couchdb# node -v
v0.10.25
root@teo-Home:/var/log/couchdb# tail couch.log
[Sun, 20 Mar 2016 08:55:34 GMT] [debug] [<0.95.0>] Linked process died abnormally: <0.13034.0> (reason: {badarg,
     [{erlang,
       port_command,
       [#Port<0.11269>,
        [<<"[\"reset\",{\"reduce_limit\":true,\"timeout\":5000}]">>,
         10]],
       []},
      {couch_os_process,
       writejson,
       2,
       [{file,
         "couch_os_process.erl"},
        {line,
         93}]},
      {couch_os_process,
       handle_call,
       3,
       [{file,
         "couch_os_process.erl"},
        {line,
         183}]},
      {gen_server,
       handle_msg,
       5,
       [{file,
         "gen_server.erl"},
        {line,
         580}]},
      {proc_lib,
       init_p_do_apply,
       3,
       [{file,
         "proc_lib.erl"},
        {line,
         237}]}]})