Ah, interesting. I don't speak Python, but it didn't look like that script had any loop in it.
That might be a good thing to mention in the "Common Pitfalls" section Thanks. ________________________________ From: Robert Newson <[email protected]> To: [email protected]; Scott Weber <[email protected]> Sent: Wednesday, October 23, 2013 12:29 PM Subject: Re: Running Extern PHP Script Your process is required to loop over stdin and keep processing, rather than immediately exiting. B. On 23 Oct 2013, at 18:26, Scott Weber <[email protected]> wrote: > Hello All, > I am trying to run a PHP script, using this basic tutorial: > http://wiki.apache.org/couchdb/ExternalProcesses > > My test script is AMAZINGLY simple, as a tutorial to test with: > <?php > $line1 = trim(fgets(STDIN)); > fwrite(STDOUT, "{\"code\":200 , \"body\" : \"The script ran\" }\n"); > fflush(STDOUT); > ?> > > It runs from the command line just fine. > > > It runs from couch every *other* time. That is when I press 'refresh' on the > browser, it goes between the proper output and an error. (This tells me the > INI is set up correctly) > > > I am running on a Raspberry Pi, if that make any difference. > > I have tried terminating with both "\r\n" and just "\n" but it makes no > difference. > The couch log is rather long, so I pasted the "reason for termination" below. > I don't know what "noproc" means in the log. > > Can anyone tell me what I have done wrong? And why it is executing properly > every *other* time? > Any advice would be appreciated. > > -Scott Weber > > > ---- Segment from the log when the failure occurs ------------- > ** When Server state == {"Test","php /srv/dcc/php/test1.php",<0.3037.0>} > ** Reason for termination == > ** {noproc, > {gen_server,call, > [<0.3037.0>, > {prompt, > {[{<<"info">>, > {[{db_name,<<"source">>}, > {doc_count,3}, > {doc_del_count,0}, > {update_seq,93}, > {purge_seq,0}, > {compact_running,false}, > {disk_size,1388645}, > {data_size,1038753}, > {instance_start_time,<<"1382548060839095">>}, > {disk_format_version,6}, > {committed_update_seq,93}]}}, > {<<"id">>,null}, > {<<"uuid">>,<<"bc7971280ff76f9ec6c648763d004211">>}, > {<<"method">>,'GET'}, > {<<"requested_path">>,[<<"source">>,<<"_TEST">>]}, > {<<"path">>,[<<"source">>,<<"_TEST">>]}, > {<<"raw_path">>,<<"/source/_TEST">>}, > {<<"query">>,{[]}}, > {<<"headers">>, > {[{<<"Accept">>, > ><<"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8">>}, > {<<"Accept-Encoding">>,<<"gzip, deflate">>}, > {<<"Accept-Language">>,<<"en-US,en;q=0.5">>}, > {<<"Cache-Control">>,<<"max-age=0">>}, > {<<"Connection">>,<<"keep-alive">>}, > {<<"Cookie">>, > ><<"AuthSession=cmlhbjo1MjY3RjAwNDq4lB9rSSuDo5wXUqWcP7cGNb63Gg">>}, > {<<"Host">>,<<"raspberrypi2:5984">>}, > {<<"User-Agent">>, > <<"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) >Gecko/20100101 Firefox/24.0">>}]}}, > {<<"body">>,undefined}, > {<<"peer">>,<<"192.168.1.70">>}, > {<<"form">>,{[]}}, > {<<"cookie">>, > {[{<<"AuthSession">>, > ><<"cmlhbjo1MjY3RjAwNDq4lB9rSSuDo5wXUqWcP7cGNb63Gg">>}]}}, > {<<"userCtx">>, > {[{<<"db">>,<<"source">>}, > {<<"name">>,null}, > {<<"roles">>,[]}]}}, > {<<"secObj">>,{[]}}]}}, > infinity]}} > > [Wed, 23 Oct 2013 17:10:01 GMT] [error] [<0.3036.0>] {error_report,<0.31.0>, > {<0.3036.0>,crash_report, > [[{initial_call, > {couch_external_server,init,['Argument__1']}}, > {pid,<0.3036.0>}, > {registered_name,[]}, > {error_info, > {exit, > {noproc, > {gen_server,call, > [<0.3037.0>, > {prompt, > {[{<<"info">>, > {[{db_name,<<"source">>}, > {doc_count,3}, > {doc_del_count,0}, > {update_seq,93}, > {purge_seq,0}, > {compact_running,false}, > {disk_size,1388645}, > {data_size,1038753}, > {instance_start_time, > <<"1382548060839095">>}, > {disk_format_version,6}, > {committed_update_seq,93}]}}, > {<<"id">>,null}, > {<<"uuid">>, > <<"bc7971280ff76f9ec6c648763d004211">>}, > {<<"method">>,'GET'}, > {<<"requested_path">>, > [<<"source">>,<<"_TEST">>]}, > {<<"path">>,[<<"source">>,<<"_TEST">>]}, > {<<"raw_path">>,<<"/source/_TEST">>}, > {<<"query">>,{[]}}, > {<<"headers">>, > {[{<<"Accept">>, > ><<"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8">>}, > {<<"Accept-Encoding">>, > <<"gzip, deflate">>}, > {<<"Accept-Language">>, > <<"en-US,en;q=0.5">>}, > {<<"Cache-Control">>,<<"max-age=0">>}, > {<<"Connection">>,<<"keep-alive">>}, > {<<"Cookie">>, > ><<"AuthSession=cmlhbjo1MjY3RjAwNDq4lB9rSSuDo5wXUqWcP7cGNb63Gg">>}, > {<<"Host">>,<<"raspberrypi2:5984">>}, > {<<"User-Agent">>, > <<"Mozilla/5.0 (Windows NT 6.1; WOW64; >rv:24.0) Gecko/20100101 Firefox/24.0">>}]}}, > {<<"body">>,undefined}, > {<<"peer">>,<<"192.168.1.70">>}, > {<<"form">>,{[]}}, > {<<"cookie">>, > {[{<<"AuthSession">>, > ><<"cmlhbjo1MjY3RjAwNDq4lB9rSSuDo5wXUqWcP7cGNb63Gg">>}]}}, > {<<"userCtx">>, > {[{<<"db">>,<<"source">>}, > {<<"name">>,null}, > {<<"roles">>,[]}]}}, > {<<"secObj">>,{[]}}]}}, > infinity]}}, > [{gen_server,terminate,6, > [{file,"gen_server.erl"},{line,747}]}, > {proc_lib,init_p_do_apply,3, > [{file,"proc_lib.erl"},{line,227}]}]}}, > {ancestors, > [couch_external_manager,couch_secondary_services, > couch_server_sup,<0.32.0>]}, > {messages,[]}, > {links,[<0.3033.0>]}, > {dictionary,[]}, > {trap_exit,true}, > {status,running}, > {heap_size,987}, > {stack_size,24}, > {reductions,1197}], > []]}} > [Wed, 23 Oct 2013 17:10:01 GMT] [info] [<0.3033.0>] EXTERNAL: Server > <0.3036.0> died. (reason: {noproc, > {gen_server, > call, > [<0.3037.0>, > {prompt, > >{[{<<"info">>, > >{[{db_name, > ><<"source">>}, > >{doc_count, > 3}, > >{doc_del_count, > 0}, > >{update_seq, > 93}, > >{purge_seq, > 0}, > >{compact_running, > >false}, > >{disk_size, > >1388645}, > >{data_size, > >1038753}, > >{instance_start_time, > ><<"1382548060839095">>}, > >{disk_format_version, > 6}, > >{committed_update_seq, > >93}]}}, > >{<<"id">>, > null}, > >{<<"uuid">>, > ><<"bc7971280ff76f9ec6c648763d004211">>}, > >{<<"method">>, > 'GET'}, > >{<<"requested_path">>, > >[<<"source">>, > ><<"_TEST">>]}, > >{<<"path">>, > >[<<"source">>, > ><<"_TEST">>]}, > >{<<"raw_path">>, > ><<"/source/_TEST">>}, > >{<<"query">>, > {[]}}, > >{<<"headers">>, > >{[{<<"Accept">>, > ><<"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8">>}, > >{<<"Accept-Encoding">>, > ><<"gzip, deflate">>}, > >{<<"Accept-Language">>, > ><<"en-US,en;q=0.5">>}, > >{<<"Cache-Control">>, > ><<"max-age=0">>}, > >{<<"Connection">>, > ><<"keep-alive">>}, > >{<<"Cookie">>, > ><<"AuthSession=cmlhbjo1MjY3RjAwNDq4lB9rSSuDo5wXUqWcP7cGNb63Gg">>}, > >{<<"Host">>, > ><<"raspberrypi2:5984">>}, > >{<<"User-Agent">>, > ><<"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 >Firefox/24.0">>}]}}, > >{<<"body">>, > >undefined}, > >{<<"peer">>, > ><<"192.168.1.70">>}, > >{<<"form">>, > {[]}}, > >{<<"cookie">>, > >{[{<<"AuthSession">>, > ><<"cmlhbjo1MjY3RjAwNDq4lB9rSSuDo5wXUqWcP7cGNb63Gg">>}]}}, > >{<<"userCtx">>, > >{[{<<"db">>, > ><<"source">>}, > >{<<"name">>, > >null}, > >{<<"roles">>, > >[]}]}}, > >{<<"secObj">>, > >{[]}}]}}, > infinity]}})
