HTTP 500 in browser and couchdb-external-hook.py #156

Closed
br00t999 opened this Issue Mar 14, 2012 · 7 comments

Projects

None yet

2 participants

@br00t999

I believe this may possibly be a duplicate of closed issue #144 (apologies if this is the case) but here goes anyways...

Ubuntu 10.04 LTS
root@ubuntu:/opt# uname -ar
Linux ubuntu 2.6.32-39-generic #86-Ubuntu SMP Mon Feb 13 21:50:08 UTC 2012 x86_64 GNU/Linux
root@ubuntu:/opt# xulrunner -v
Mozilla XULRunner 1.9.2.27 - 20120217112947
root@ubuntu:/opt# curl 'http://localhost:5984'
{"couchdb":"Welcome","version":"1.1.1"}
root@ubuntu:/opt# curl 'http://localhost:5985'
{"couchdb-lucene":"Welcome","version":"0.9.0-SNAPSHOT"}

Couchdb is running as user couchdb and has full permissions to the indexes directory for couchdb-lucene.

I have a test DB called lucene-test with a couple of documents and the following design doc:

{
"_id": "_design/lucene",
"language": "javascript",
"fulltext": {
"by_content": {
"index": "function(doc) { var res = new Document(); res.add( doc.content ); return ret; }"
}
}
}

Requests in browser to http://192.168.166.133:5984/lucene-test/_fti/_design/lucene/by_content?q=steal yields HTTP 500 error. Here is the debug log:

[Wed, 14 Mar 2012 17:06:29 GMT] [info] [<0.33.0>] Apache CouchDB has started on http://0.0.0.0:5984/
[Wed, 14 Mar 2012 17:06:43 GMT] [debug] [<0.223.0>] 'GET' /lucene-test/_fti/_design/lucene/by_content?q=steal {1,
1} from "192.168.166.1"
Headers: [{'Accept',"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"},
{'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,;q=0.3"},
{'Accept-Encoding',"gzip,deflate,sdch"},
{'Accept-Language',"en-GB,en-US;q=0.8,en;q=0.6"},
{'Cache-Control',"max-age=0"},
{'Connection',"keep-alive"},
{'Host',"192.168.166.133:5984"},
{'User-Agent',"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11"}]
[Wed, 14 Mar 2012 17:06:43 GMT] [debug] [<0.223.0>] OAuth Params: [{"q","steal"}]
[Wed, 14 Mar 2012 17:06:43 GMT] [info] [<0.254.0>] EXTERNAL: Starting process for: fti
[Wed, 14 Mar 2012 17:06:43 GMT] [info] [<0.254.0>] COMMAND: /opt/couchdb-lucene-0.9-SNAPSHOT/tools/couchdb-external-hook.py
[Wed, 14 Mar 2012 17:06:43 GMT] [debug] [<0.255.0>] OS Process Start :: #Port<0.1886>
[Wed, 14 Mar 2012 17:06:43 GMT] [debug] [<0.255.0>] OS Process #Port<0.1886> Input :: {"info":{"db_name":"lucene-test","doc_count":3,"doc_del_count":0,"update_seq":4,"purge_seq":0,"compact_running":false,"disk_size":36953,"instance_start_time":"1331744803381151","disk_format_version":5,"committed_update_seq":4},"id":null,"uuid":"ce01335b3b8924dce6f0b1b850000928","method":"GET","requested_path":["lucene-test","_fti","_design","lucene","by_content?q=steal"],"path":["lucene-test","_fti","_design","lucene","by_content"],"query":{"q":"steal"},"headers":{"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,
/;q=0.8","Accept-Charset":"ISO-8859-1,utf-8;q=0.7,;q=0.3","Accept-Encoding":"gzip,deflate,sdch","Accept-Language":"en-GB,en-US;q=0.8,en;q=0.6","Cache-Control":"max-age=0","Connection":"keep-alive","Host":"192.168.166.133:5984","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11"},"body":"undefined","peer":"192.168.166.1","form":{},"cookie":{},"userCtx":{"db":"lucene-test","name":null,"roles":["_admin"]},"secObj":{}}
[Wed, 14 Mar 2012 17:06:43 GMT] [error] [<0.254.0>] OS Process Error <0.255.0> :: {os_process_error,
{exit_status,2}}
[Wed, 14 Mar 2012 17:06:43 GMT] [error] [<0.254.0>] ** Generic server <0.254.0> terminating
** Last message in was {execute,
{[{<<"info">>,
{[{db_name,<<"lucene-test">>},
{doc_count,3},
{doc_del_count,0},
{update_seq,4},
{purge_seq,0},
{compact_running,false},
{disk_size,36953},
{instance_start_time,<<"1331744803381151">>},
{disk_format_version,5},
{committed_update_seq,4}]}},
{<<"id">>,null},
{<<"uuid">>,
<<"ce01335b3b8924dce6f0b1b850000928">>},
{<<"method">>,'GET'},
{<<"requested_path">>,
[<<"lucene-test">>,<<"_fti">>,<<"_design">>,
<<"lucene">>,<<"by_content?q=steal">>]},
{<<"path">>,
[<<"lucene-test">>,<<"_fti">>,<<"_design">>,
<<"lucene">>,<<"by_content">>]},
{<<"query">>,{[{<<"q">>,<<"steal">>}]}},
{<<"headers">>,
{[{<<"Accept">>,
<<"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8">>},
{<<"Accept-Charset">>,
<<"ISO-8859-1,utf-8;q=0.7,;q=0.3">>},
{<<"Accept-Encoding">>,
<<"gzip,deflate,sdch">>},
{<<"Accept-Language">>,
<<"en-GB,en-US;q=0.8,en;q=0.6">>},
{<<"Cache-Control">>,<<"max-age=0">>},
{<<"Connection">>,<<"keep-alive">>},
{<<"Host">>,<<"192.168.166.133:5984">>},
{<<"User-Agent">>,
<<"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11">>}]}},
{<<"body">>,undefined},
{<<"peer">>,<<"192.168.166.1">>},
{<<"form">>,{[]}},
{<<"cookie">>,{[]}},
{<<"userCtx">>,
{[{<<"db">>,<<"lucene-test">>},
{<<"name">>,null},
{<<"roles">>,[<<"_admin">>]}]}},
{<<"secObj">>,{[]}}]}}
*
When Server state == {"fti",
"/opt/couchdb-lucene-0.9-SNAPSHOT/tools/couchdb-external-hook.py",
<0.255.0>}
** Reason for termination ==
** {bad_return_value,{os_process_error,{exit_status,2}}}

[Wed, 14 Mar 2012 17:06:43 GMT] [error] [<0.254.0>] {error_report,<0.32.0>,
{<0.254.0>,crash_report,
[[{initial_call,
{couch_external_server,init,['Argument__1']}},
{pid,<0.254.0>},
{registered_name,[]},
{error_info,
{exit,
{bad_return_value,
{os_process_error,{exit_status,2}}},
[{gen_server,terminate,6},
{proc_lib,init_p_do_apply,3}]}},
{ancestors,
[couch_external_manager,
couch_secondary_services,couch_server_sup,
<0.33.0>]},
{messages,[{'EXIT',<0.255.0>,normal}]},
{links,[<0.132.0>]},
{dictionary,[]},
{trap_exit,true},
{status,running},
{heap_size,1597},
{stack_size,24},
{reductions,2040}],
[]]}}
[Wed, 14 Mar 2012 17:06:43 GMT] [info] [<0.132.0>] EXTERNAL: Server <0.254.0> died. (reason: {bad_return_value,
{os_process_error,
{exit_status,
2}}})
[Wed, 14 Mar 2012 17:06:43 GMT] [error] [<0.223.0>] Uncaught error in HTTP request: {exit,
{{bad_return_value,
{os_process_error,
{exit_status,2}}},
{gen_server,call,
[<0.254.0>,
{execute,
{[{<<"info">>,
{[{db_name,
<<"lucene-test">>},
{doc_count,3},
{doc_del_count,
0},
{update_seq,4},
{purge_seq,0},
{compact_running,
false},
{disk_size,
36953},
{instance_start_time,
<<"1331744803381151">>},
{disk_format_version,
5},
{committed_update_seq,
4}]}},
{<<"id">>,null},
{<<"uuid">>,
<<"ce01335b3b8924dce6f0b1b850000928">>},
{<<"method">>,
'GET'},
{<<"requested_path">>,
[<<"lucene-test">>,
<<"_fti">>,
<<"_design">>,
<<"lucene">>,
<<"by_content?q=steal">>]},
{<<"path">>,
[<<"lucene-test">>,
<<"_fti">>,
<<"_design">>,
<<"lucene">>,
<<"by_content">>]},
{<<"query">>,
{[{<<"q">>,
<<"steal">>}]}},
{<<"headers">>,
{[{<<"Accept">>,
<<"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8">>},
{<<"Accept-Charset">>,
<<"ISO-8859-1,utf-8;q=0.7,;q=0.3">>},
{<<"Accept-Encoding">>,
<<"gzip,deflate,sdch">>},
{<<"Accept-Language">>,
<<"en-GB,en-US;q=0.8,en;q=0.6">>},
{<<"Cache-Control">>,
<<"max-age=0">>},
{<<"Connection">>,
<<"keep-alive">>},
{<<"Host">>,
<<"192.168.166.133:5984">>},
{<<"User-Agent">>,
<<"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11">>}]}},
{<<"body">>,
undefined},
{<<"peer">>,
<<"192.168.166.1">>},
{<<"form">>,{[]}},
{<<"cookie">>,{[]}},
{<<"userCtx">>,
{[{<<"db">>,
<<"lucene-test">>},
{<<"name">>,
null},
{<<"roles">>,
[<<"_admin">>]}]}},
{<<"secObj">>,
{[]}}]}},
infinity]}}}
[Wed, 14 Mar 2012 17:06:43 GMT] [error] [<0.87.0>] {error_report,<0.32.0>,
{<0.87.0>,supervisor_report,
[{supervisor,{local,couch_secondary_services}},
{errorContext,child_terminated},
{reason,normal},
{offender,
[{pid,<0.132.0>},
{name,external_manager},
{mfa,{couch_external_manager,start_link,[]}},
{restart_type,permanent},
{shutdown,1000},
{child_type,worker}]}]}}
[Wed, 14 Mar 2012 17:06:43 GMT] [info] [<0.223.0>] Stacktrace: [{io_lib_pretty,cind_tag_tuple,7},
{io_lib_pretty,while_fail,3},
{io_lib_pretty,print,6},
{io_lib_format,build,3},
{io_lib_format,build,3},
{io_lib_format,build,3},
{io_lib_format,build,3},
{io_lib_format,build,3}]
[Wed, 14 Mar 2012 17:06:43 GMT] [info] [<0.223.0>] 192.168.166.1 - - 'GET' /lucene-test/_fti/_design/lucene/by_content?q=steal 500
[Wed, 14 Mar 2012 17:06:43 GMT] [debug] [<0.223.0>] httpd 500 error response:
{"error":"{bad_return_value,{os_process_error,{exit_status,2}}}","reason":"{gen_server,call,\n [<0.254.0>,\n {execute,{[{<<\"info\">>,\n {[{db_name,<<\"lucene-test\">>},\n {doc_count,3},\n {doc_del_count,0},\n {update_seq,4},\n {purge_seq,0},\n {compact_running,false},\n {disk_size,36953},\n {instance_start_time,<<\"1331744803381151\">>},\n {disk_format_version,5},\n {committed_update_seq,4}]}},\n {<<\"id\">>,null},\n {<<\"uuid\">>,<<\"ce01335b3b8924dce6f0b1b850000928\">>},\n {<<\"method\">>,'GET'},\n {<<\"requested_path\">>,\n [<<\"lucene-test\">>,<<\"_fti\">>,<<\"_design\">>,\n <<\"lucene\">>,<<\"by_content?q=steal\">>]},\n {<<\"path\">>,\n [<<\"lucene-test\">>,<<\"_fti\">>,<<\"_design\">>,\n <<\"lucene\">>,<<\"by_content\">>]},\n {<<\"query\">>,{[{<<\"q\">>,<<\"steal\">>}]}},\n {<<\"headers\">>,\n {[{<<\"Accept\">>,\n <<\"text/html,application/xhtml+xml,application/xml;q=0.9,
/;q=0.8\">>},\n {<<\"Accept-Charset\">>,\n <<\"ISO-8859-1,utf-8;q=0.7,;q=0.3\">>},\n {<<\"Accept-Encoding\">>,<<\"gzip,deflate,sdch\">>},\n {<<\"Accept-Language\">>,\n <<\"en-GB,en-US;q=0.8,en;q=0.6\">>},\n {<<\"Cache-Control\">>,<<\"max-age=0\">>},\n {<<\"Connection\">>,<<\"keep-alive\">>},\n {<<\"Host\">>,<<\"192.168.166.133:5984\">>},\n {<<\"User-Agent\">>,\n <<\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11\">>}]}},\n {<<\"body\">>,undefined},\n {<<\"peer\">>,<<\"192.168.166.1\">>},\n {<<\"form\">>,{[]}},\n {<<\"cookie\">>,{[]}},\n {<<\"userCtx\">>,\n {[{<<\"db\">>,<<\"lucene-test\">>},\n {<<\"name\">>,null},\n {<<\"roles\">>,[<<\"_admin\">>]}]}},\n {<<\"secObj\">>,{[]}}]}},\n infinity]}"}

When I attempt to execute the same query via couchdb-external-hook.py I get the following result:

root@ubuntu:/opt/couchdb-lucene-0.9.0-SNAPSHOT/tools# python couchdb-external-hook.py
{"info":{"db_name":"lucene-test","doc_count":3,"doc_del_count":0,"update_seq":4,"purge_seq":0,"compact_running":false,"disk_size":36953,"instance_start_time":"1331744803381151","disk_format_version":5,"committed_update_seq":4},"id":null,"uuid":"ce01335b3b8924dce6f0b1b850000928","method":"GET","requested_path":["lucene-test","_fti","_design","lucene","by_content?q=steal"],"path":["lucene-test","_fti","_design","lucene","by_content"],"query":{"q":"steal"},"headers":{"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8","Accept-Charset":"ISO-8859-1,utf-8;q=0.7,;q=0.3","Accept-Encoding":"gzip,deflate,sdch","Accept-Language":"en-GB,en-US;q=0.8,en;q=0.6","Cache-Control":"max-age=0","Connection":"keep-alive","Host":"192.168.166.133:5984","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11"},"body":"undefined","peer":"192.168.166.1","form":{},"cookie":{},"userCtx":{"db":"lucene-test","name":null,"roles":["_admin"]},"secObj":{}}
{"body": "{\"reason\":\"Search timed out.\",\"code\":500}\r\n", "headers": {"Content-Type": "text/plain; charset=utf-8"}, "code": 500}
{"info":{"db_name":"lucene-test","doc_count":3,"doc_del_count":0,"update_seq":4,"purge_seq":0,"compact_running":false,"disk_size":36953,"instance_start_time":"1331744803381151","disk_format_version":5,"committed_update_seq":4},"id":null,"uuid":"ce01335b3b8924dce6f0b1b850000928","method":"GET","requested_path":["lucene-test","_fti","_design","lucene","by_content?q=steal"],"path":["lucene-test","_fti","_design","lucene","by_content"],"query":{"q":"steal"},"headers":{"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,
/;q=0.8","Accept-Charset":"ISO-8859-1,utf-8;q=0.7,;q=0.3","Accept-Encoding":"gzip,deflate,sdch","Accept-Language":"en-GB,en-US;q=0.8,en;q=0.6","Cache-Control":"max-age=0","Connection":"keep-alive","Host":"192.168.166.133:5984","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11"},"body":"undefined","peer":"192.168.166.1","form":{},"cookie":{},"userCtx":{"db":"lucene-test","name":null,"roles":["_admin"]},"secObj":{}}
{"body": "{\"reason\":\"Search timed out.\",\"code\":500}\r\n", "headers": {"Content-Type": "text/plain; charset=utf-8"}, "code": 500}

So in summary it is flaming out in browser and timing out in the command line interface. Any suggestions?

Thanks a lot!

@rnewson
Owner

You have "_fti=/opt/couchdb-lucene-0.9-SNAPSHOT/tools/couchdb-external-hook.py". I suggest you try "_fti=/full/path/to/python /opt/couchdb-lucene-0.9-SNAPSHOT/tools/couchdb-external-hook.py" first.

@br00t999

Alas... no joy...

Browser fail...

[Wed, 14 Mar 2012 17:33:47 GMT] [debug] [<0.172.0>] 'GET' /lucene-test/_fti/_design/lucene/by_content?q=steal {1,
1} from "192.168.166.1"
Headers: [{'Accept',"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"},
{'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,;q=0.3"},
{'Accept-Encoding',"gzip,deflate,sdch"},
{'Accept-Language',"en-GB,en-US;q=0.8,en;q=0.6"},
{'Cache-Control',"max-age=0"},
{'Connection',"keep-alive"},
{'Host',"192.168.166.133:5984"},
{'User-Agent',"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11"}]
[Wed, 14 Mar 2012 17:33:47 GMT] [debug] [<0.172.0>] OAuth Params: [{"q","steal"}]
[Wed, 14 Mar 2012 17:33:47 GMT] [info] [<0.424.0>] EXTERNAL: Starting process for: fti
[Wed, 14 Mar 2012 17:33:47 GMT] [info] [<0.424.0>] COMMAND: /usr/bin/python /opt/couchdb-lucene-0.9-SNAPSHOT/tools/couchdb-external-hook.py
[Wed, 14 Mar 2012 17:33:47 GMT] [debug] [<0.425.0>] OS Process Start :: #Port<0.1929>
[Wed, 14 Mar 2012 17:33:47 GMT] [debug] [<0.425.0>] OS Process #Port<0.1929> Input :: {"info":{"db_name":"lucene-test","doc_count":3,"doc_del_count":0,"update_seq":4,"purge_seq":0,"compact_running":false,"disk_size":41051,"instance_start_time":"1331746403884858","disk_format_version":5,"committed_update_seq":4},"id":null,"uuid":"a8fb6e6d8b8bde53a756ab0744000054","method":"GET","requested_path":["lucene-test","_fti","_design","lucene","by_content?q=steal"],"path":["lucene-test","_fti","_design","lucene","by_content"],"query":{"q":"steal"},"headers":{"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,
/;q=0.8","Accept-Charset":"ISO-8859-1,utf-8;q=0.7,;q=0.3","Accept-Encoding":"gzip,deflate,sdch","Accept-Language":"en-GB,en-US;q=0.8,en;q=0.6","Cache-Control":"max-age=0","Connection":"keep-alive","Host":"192.168.166.133:5984","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11"},"body":"undefined","peer":"192.168.166.1","form":{},"cookie":{},"userCtx":{"db":"lucene-test","name":null,"roles":["_admin"]},"secObj":{}}
[Wed, 14 Mar 2012 17:33:47 GMT] [error] [<0.424.0>] OS Process Error <0.425.0> :: {os_process_error,
{exit_status,2}}
[Wed, 14 Mar 2012 17:33:47 GMT] [error] [<0.424.0>] ** Generic server <0.424.0> terminating
** Last message in was {execute,
{[{<<"info">>,
{[{db_name,<<"lucene-test">>},
{doc_count,3},
{doc_del_count,0},
{update_seq,4},
{purge_seq,0},
{compact_running,false},
{disk_size,41051},
{instance_start_time,<<"1331746403884858">>},
{disk_format_version,5},
{committed_update_seq,4}]}},
{<<"id">>,null},
{<<"uuid">>,
<<"a8fb6e6d8b8bde53a756ab0744000054">>},
{<<"method">>,'GET'},
{<<"requested_path">>,
[<<"lucene-test">>,<<"_fti">>,<<"_design">>,
<<"lucene">>,<<"by_content?q=steal">>]},
{<<"path">>,
[<<"lucene-test">>,<<"_fti">>,<<"_design">>,
<<"lucene">>,<<"by_content">>]},
{<<"query">>,{[{<<"q">>,<<"steal">>}]}},
{<<"headers">>,
{[{<<"Accept">>,
<<"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8">>},
{<<"Accept-Charset">>,
<<"ISO-8859-1,utf-8;q=0.7,;q=0.3">>},
{<<"Accept-Encoding">>,
<<"gzip,deflate,sdch">>},
{<<"Accept-Language">>,
<<"en-GB,en-US;q=0.8,en;q=0.6">>},
{<<"Cache-Control">>,<<"max-age=0">>},
{<<"Connection">>,<<"keep-alive">>},
{<<"Host">>,<<"192.168.166.133:5984">>},
{<<"User-Agent">>,
<<"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11">>}]}},
{<<"body">>,undefined},
{<<"peer">>,<<"192.168.166.1">>},
{<<"form">>,{[]}},
{<<"cookie">>,{[]}},
{<<"userCtx">>,
{[{<<"db">>,<<"lucene-test">>},
{<<"name">>,null},
{<<"roles">>,[<<"_admin">>]}]}},
{<<"secObj">>,{[]}}]}}
*
When Server state == {"fti",
"/usr/bin/python /opt/couchdb-lucene-0.9-SNAPSHOT/tools/couchdb-external-hook.py",
<0.425.0>}
** Reason for termination ==
** {bad_return_value,{os_process_error,{exit_status,2}}}

[Wed, 14 Mar 2012 17:33:47 GMT] [error] [<0.424.0>] {error_report,<0.32.0>,
{<0.424.0>,crash_report,
[[{initial_call,
{couch_external_server,init,['Argument__1']}},
{pid,<0.424.0>},
{registered_name,[]},
{error_info,
{exit,
{bad_return_value,
{os_process_error,{exit_status,2}}},
[{gen_server,terminate,6},
{proc_lib,init_p_do_apply,3}]}},
{ancestors,
[couch_external_manager,
couch_secondary_services,couch_server_sup,
<0.33.0>]},
{messages,[{'EXIT',<0.425.0>,normal}]},
{links,[<0.132.0>]},
{dictionary,[]},
{trap_exit,true},
{status,running},
{heap_size,610},
{stack_size,24},
{reductions,2016}],
[]]}}
[Wed, 14 Mar 2012 17:33:47 GMT] [info] [<0.132.0>] EXTERNAL: Server <0.424.0> died. (reason: {bad_return_value,
{os_process_error,
{exit_status,
2}}})
[Wed, 14 Mar 2012 17:33:47 GMT] [error] [<0.172.0>] Uncaught error in HTTP request: {exit,
{{bad_return_value,
{os_process_error,
{exit_status,2}}},
{gen_server,call,
[<0.424.0>,
{execute,
{[{<<"info">>,
{[{db_name,
<<"lucene-test">>},
{doc_count,3},
{doc_del_count,
0},
{update_seq,4},
{purge_seq,0},
{compact_running,
false},
{disk_size,
41051},
{instance_start_time,
<<"1331746403884858">>},
{disk_format_version,
5},
{committed_update_seq,
4}]}},
{<<"id">>,null},
{<<"uuid">>,
<<"a8fb6e6d8b8bde53a756ab0744000054">>},
{<<"method">>,
'GET'},
{<<"requested_path">>,
[<<"lucene-test">>,
<<"_fti">>,
<<"_design">>,
<<"lucene">>,
<<"by_content?q=steal">>]},
{<<"path">>,
[<<"lucene-test">>,
<<"_fti">>,
<<"_design">>,
<<"lucene">>,
<<"by_content">>]},
{<<"query">>,
{[{<<"q">>,
<<"steal">>}]}},
{<<"headers">>,
{[{<<"Accept">>,
<<"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8">>},
{<<"Accept-Charset">>,
<<"ISO-8859-1,utf-8;q=0.7,;q=0.3">>},
{<<"Accept-Encoding">>,
<<"gzip,deflate,sdch">>},
{<<"Accept-Language">>,
<<"en-GB,en-US;q=0.8,en;q=0.6">>},
{<<"Cache-Control">>,
<<"max-age=0">>},
{<<"Connection">>,
<<"keep-alive">>},
{<<"Host">>,
<<"192.168.166.133:5984">>},
{<<"User-Agent">>,
<<"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11">>}]}},
{<<"body">>,
undefined},
{<<"peer">>,
<<"192.168.166.1">>},
{<<"form">>,{[]}},
{<<"cookie">>,{[]}},
{<<"userCtx">>,
{[{<<"db">>,
<<"lucene-test">>},
{<<"name">>,
null},
{<<"roles">>,
[<<"_admin">>]}]}},
{<<"secObj">>,
{[]}}]}},
infinity]}}}
[Wed, 14 Mar 2012 17:33:47 GMT] [error] [<0.87.0>] {error_report,<0.32.0>,
{<0.87.0>,supervisor_report,
[{supervisor,{local,couch_secondary_services}},
{errorContext,child_terminated},
{reason,normal},
{offender,
[{pid,<0.132.0>},
{name,external_manager},
{mfa,{couch_external_manager,start_link,[]}},
{restart_type,permanent},
{shutdown,1000},
{child_type,worker}]}]}}
[Wed, 14 Mar 2012 17:33:47 GMT] [info] [<0.172.0>] Stacktrace: [{io_lib_pretty,cind_tag_tuple,7},
{io_lib_pretty,while_fail,3},
{io_lib_pretty,print,6},
{io_lib_format,build,3},
{io_lib_format,build,3},
{io_lib_format,build,3},
{io_lib_format,build,3},
{io_lib_format,build,3}]
[Wed, 14 Mar 2012 17:33:47 GMT] [info] [<0.172.0>] 192.168.166.1 - - 'GET' /lucene-test/_fti/_design/lucene/by_content?q=steal 500
[Wed, 14 Mar 2012 17:33:47 GMT] [debug] [<0.172.0>] httpd 500 error response:
{"error":"{bad_return_value,{os_process_error,{exit_status,2}}}","reason":"{gen_server,call,\n [<0.424.0>,\n {execute,{[{<<\"info\">>,\n {[{db_name,<<\"lucene-test\">>},\n {doc_count,3},\n {doc_del_count,0},\n {update_seq,4},\n {purge_seq,0},\n {compact_running,false},\n {disk_size,41051},\n {instance_start_time,<<\"1331746403884858\">>},\n {disk_format_version,5},\n {committed_update_seq,4}]}},\n {<<\"id\">>,null},\n {<<\"uuid\">>,<<\"a8fb6e6d8b8bde53a756ab0744000054\">>},\n {<<\"method\">>,'GET'},\n {<<\"requested_path\">>,\n [<<\"lucene-test\">>,<<\"_fti\">>,<<\"_design\">>,\n <<\"lucene\">>,<<\"by_content?q=steal\">>]},\n {<<\"path\">>,\n [<<\"lucene-test\">>,<<\"_fti\">>,<<\"_design\">>,\n <<\"lucene\">>,<<\"by_content\">>]},\n {<<\"query\">>,{[{<<\"q\">>,<<\"steal\">>}]}},\n {<<\"headers\">>,\n {[{<<\"Accept\">>,\n <<\"text/html,application/xhtml+xml,application/xml;q=0.9,
/;q=0.8\">>},\n {<<\"Accept-Charset\">>,\n <<\"ISO-8859-1,utf-8;q=0.7,;q=0.3\">>},\n {<<\"Accept-Encoding\">>,<<\"gzip,deflate,sdch\">>},\n {<<\"Accept-Language\">>,\n <<\"en-GB,en-US;q=0.8,en;q=0.6\">>},\n {<<\"Cache-Control\">>,<<\"max-age=0\">>},\n {<<\"Connection\">>,<<\"keep-alive\">>},\n {<<\"Host\">>,<<\"192.168.166.133:5984\">>},\n {<<\"User-Agent\">>,\n <<\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11\">>}]}},\n {<<\"body\">>,undefined},\n {<<\"peer\">>,<<\"192.168.166.1\">>},\n {<<\"form\">>,{[]}},\n {<<\"cookie\">>,{[]}},\n {<<\"userCtx\">>,\n {[{<<\"db\">>,<<\"lucene-test\">>},\n {<<\"name\">>,null},\n {<<\"roles\">>,[<<\"_admin\">>]}]}},\n {<<\"secObj\">>,{[]}}]}},\n infinity]}"}

CLI fail...

root@ubuntu:/opt/couchdb-lucene-0.9.0-SNAPSHOT/tools# python couchdb-external-hook.py
{"info":{"db_name":"lucene-test","doc_count":3,"doc_del_count":0,"update_seq":4,"purge_seq":0,"compact_running":false,"disk_size":41051,"instance_start_time":"1331746403884858","disk_format_version":5,"committed_update_seq":4},"id":null,"uuid":"a8fb6e6d8b8bde53a756ab0744000054","method":"GET","requested_path":["lucene-test","_fti","_design","lucene","by_content?q=steal"],"path":["lucene-test","_fti","_design","lucene","by_content"],"query":{"q":"steal"},"headers":{"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8","Accept-Charset":"ISO-8859-1,utf-8;q=0.7,*;q=0.3","Accept-Encoding":"gzip,deflate,sdch","Accept-Language":"en-GB,en-US;q=0.8,en;q=0.6","Cache-Control":"max-age=0","Connection":"keep-alive","Host":"192.168.166.133:5984","User-Agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11"},"body":"undefined","peer":"192.168.166.1","form":{},"cookie":{},"userCtx":{"db":"lucene-test","name":null,"roles":["_admin"]},"secObj":{}}
{"body": "{\"reason\":\"Search timed out.\",\"code\":500}\r\n", "headers": {"Content-Type": "text/plain; charset=utf-8"}, "code": 500}

@rnewson
Owner

Curious. Maybe try the new (and faster) 1.1 style and ditch the Python script entirely?

[httpd_global_handlers]
_fti = {couch_httpd_proxy, handle_proxy_req, <<"http://127.0.0.1:5985">>}

Note the url format changes: http://127.0.0.1:5984/_fti/local/db1/_design/cl-test/idx?q=hello

@br00t999

Here is my local.ini:

[couchdb]
;max_document_size = 4294967296 ; bytes
os_process_timeout=60000 ; increase the timeout from 5 seconds.

[httpd]
port = 5984
bind_address = 0.0.0.0

[httpd_global_handlers]

[couch_httpd_auth]

[log]
level = debug

[os_daemons]

[daemons]

[ssl]

[vhosts]

[update_notification]

[admins]
;admin = mysecretpassword

[external]
;fti=/usr/bin/python /opt/couchdb-lucene-0.9-SNAPSHOT/tools/couchdb-external-hook.py

[httpd_db_handlers]
_fti = {couch_httpd_external, handle_external_req, <<"fti">>}

[query_servers]
python = /usr/bin/couchpy

[httpd_global_handlers]
_fti = {couch_httpd_proxy, handle_proxy_req, <<"http://127.0.0.1:5985">>}

Restarted couchdb service...

From browser:

http://192.168.166.133:5984/_fti/local/lucene-test/_design/lucene/by_content?q=hello
{"reason":"Search timed out.","code":500}

Debug logs indicate:

[Wed, 14 Mar 2012 18:22:43 GMT] [debug] [<0.104.0>] Include Doc: <<"_design/_replicator">> {1,
<<91,250,44,153,
238,254,43,46,
180,150,45,181,
10,163,207,212>>}
[Wed, 14 Mar 2012 18:22:43 GMT] [info] [<0.33.0>] Apache CouchDB has started on http://0.0.0.0:5984/
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.225.0>] 'GET' /_fti/local/lucene-test/_design/lucene/by_content?q=hello {1,
1} from "192.168.166.1"
Headers: [{'Accept',"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"},
{'Accept-Charset',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
{'Accept-Encoding',"gzip,deflate,sdch"},
{'Accept-Language',"en-GB,en-US;q=0.8,en;q=0.6"},
{'Cache-Control',"max-age=0"},
{'Connection',"keep-alive"},
{'Host',"192.168.166.133:5984"},
{'User-Agent',"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11"}]
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.225.0>] OAuth Params: [{"q","hello"}]
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.231.0>] 'GET' /lucene-test/ {1,1} from "127.0.0.1"
Headers: [{'Connection',"Keep-Alive"},{'Host',"localhost:5984"}]
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.231.0>] OAuth Params: []
[Wed, 14 Mar 2012 18:22:57 GMT] [info] [<0.231.0>] 127.0.0.1 - - 'GET' /lucene-test/ 200
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.231.0>] 'GET' /lucene-test/_local%2Flucene {1,1} from "127.0.0.1"
Headers: [{'Connection',"Keep-Alive"},{'Host',"localhost:5984"}]
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.231.0>] OAuth Params: []
[Wed, 14 Mar 2012 18:22:57 GMT] [info] [<0.231.0>] 127.0.0.1 - - 'GET' /lucene-test/_local%2Flucene 200
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.231.0>] 'GET' /lucene-test/ {1,1} from "127.0.0.1"
Headers: [{'Connection',"Keep-Alive"},{'Host',"localhost:5984"}]
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.231.0>] OAuth Params: []
[Wed, 14 Mar 2012 18:22:57 GMT] [info] [<0.231.0>] 127.0.0.1 - - 'GET' /lucene-test/ 200
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.231.0>] 'GET' /lucene-test/_all_docs?startkey=%22_design%22&endkey=%22_design0%22&include_docs=true {1,
1} from "127.0.0.1"
Headers: [{'Connection',"Keep-Alive"},{'Host',"localhost:5984"}]
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.231.0>] OAuth Params: [{"startkey","\"_design\""},
{"endkey","\"_design0\""},
{"include_docs","true"}]
[Wed, 14 Mar 2012 18:22:57 GMT] [info] [<0.231.0>] 127.0.0.1 - - 'GET' /lucene-test/_all_docs?startkey=%22_design%22&endkey=%22_design0%22&include_docs=true 200
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.231.0>] Include Doc: <<"_design/lucene">> {2,
<<227,9,144,12,136,84,
52,61,139,219,249,
109,156,36,49,69>>}
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.231.0>] 'GET' /lucene-test/_changes?limit=0&descending=true {1,1} from "127.0.0.1"
Headers: [{'Connection',"Keep-Alive"},{'Host',"localhost:5984"}]
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.231.0>] OAuth Params: [{"limit","0"},{"descending","true"}]
[Wed, 14 Mar 2012 18:22:57 GMT] [info] [<0.231.0>] 127.0.0.1 - - 'GET' /lucene-test/_changes?limit=0&descending=true 200
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.232.0>] 'GET' /lucene-test/_changes?feed=continuous&heartbeat=15000&include_docs=true {1,
1} from "127.0.0.1"
Headers: [{'Connection',"Keep-Alive"},{'Host',"localhost:5984"}]
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.232.0>] OAuth Params: [{"feed","continuous"},
{"heartbeat","15000"},
{"include_docs","true"}]
[Wed, 14 Mar 2012 18:22:57 GMT] [info] [<0.232.0>] 127.0.0.1 - - 'GET' /lucene-test/_changes?feed=continuous&heartbeat=15000&include_docs=true 200
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.232.0>] Include Doc: <<"49fbdf474b6f4c6d31dfff311e000c6b">> {1,
<<207,48,
216,84,
234,175,
19,82,
10,159,
225,207,
214,143,
208,94>>}
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.232.0>] Include Doc: <<"49fbdf474b6f4c6d31dfff311e0011e8">> {1,
<<232,176,
154,92,
93,97,
230,79,
92,48,1,
231,102,
252,37,
215>>}
[Wed, 14 Mar 2012 18:22:57 GMT] [debug] [<0.232.0>] Include Doc: <<"_design/lucene">> {2,
<<227,9,144,12,136,84,
52,61,139,219,249,
109,156,36,49,69>>}
[Wed, 14 Mar 2012 18:23:07 GMT] [info] [<0.225.0>] 192.168.166.1 - - 'GET' /_fti/local/lucene-test/_design/lucene/by_content?q=hello 500

And then I looked at stdout for coucdb-lucene VM and I noticed...

^Croot@ubuntu:/opt/couchdb-lucene-0.9.0-SNAPSHOT/bin# ./run
2012-03-14 11:27:33,846 INFO [Config] Index output goes to: /opt/couchdb-lucene-0.9.0-SNAPSHOT/indexes
2012-03-14 11:27:33,862 INFO [Main] Accepting connections with SelectChannelConnector@localhost:5985
2012-03-14 11:27:44,857 INFO [lucene-test] Indexing from update_seq start
2012-03-14 11:27:44,928 WARN [lucene-test] 49fbdf474b6f4c6d31dfff311e000c6b caused ReferenceError: "ret" is not defined.
2012-03-14 11:27:44,954 WARN [lucene-test] 49fbdf474b6f4c6d31dfff311e0011e8 caused ReferenceError: "ret" is not defined.
2012-03-14 11:27:44,955 WARN [lucene-test] _design/lucene caused ReferenceError: "ret" is not defined.
2012-03-14 11:27:54,888 WARN [log] /local/lucene-test/_design/lucene/by_content: java.io.IOException: Search timed out.

So it looks like maybe the query is getting sent through the proxy properly and there is maybe an error in my design doc???

@rnewson
Owner

That'll do it! You declared the variable as 'res' but then did 'return ret', should be 'return res'. :)

I'd remove the obsolete _fti in [httpd_db_handlers] too.

@br00t999

Yup :-( That was it!!!

{
"_id": "_design/lucene",
"_rev": "4-649408cd4efa7f08622f6200d8eadad6",
"language": "javascript",
"fulltext": {
"by_content": {
"index": "function(doc) { var res = new Document(); res.add( doc.content ); return ret; }"
}
}
}

changed to...

{
"_id": "_design/lucene",
"_rev": "4-649408cd4efa7f08622f6200d8eadad6",
"language": "javascript",
"fulltext": {
"by_content": {
"index": "function(doc) { var res = new Document(); res.add( doc.content ); return res; }"
}
}
}

So in summary:

1) use new proxy rather than python executable
2) don't be an idiot and create design docs with obvious syntax errors LOL

Thanks so much for your prompt and helpful replies that was awesome!!!

@br00t999 br00t999 closed this Mar 14, 2012
@rnewson
Owner

happy to help. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment