Ok .. after some more debugging sessions, it looks like the problem is with
launching of the view server script. I tried with some debug statements
(even something that writes to a file), but got nothing. The couchdb log
shows references to the script, but I think it cannot do a launch of it. The
script is written in Scala and begins with the usual stuff of shell
invocation ..
#!/bin/sh
exec ~/software/scala/scala-2.7.4.final/bin/scala -classpath
~/projects/util/lib/dispatch.jar -nocompdaemon "$0" "$@"
!#
//.. scala code here
The script runs ok when I invoke it from shell. But looks like it gets into
some problem when invoked by CouchDB. Futon also comes up with the following
error ..
Error: badmatch
{{nocatch,{invalid_json,<<"!!!">>}},
[{couch_os_process,prompt,2},
{couch_query_servers,'-start_doc_map/2-fun-0-',2},
{lists,foreach,2},
{couch_query_servers,start_doc_map,2},
{couch_view_updater,view_compute,2},
{couch_view_updater,update,1}]}
And here are some more errors from couch.log ..
[Fri, 15 May 2009 12:29:50 GMT] [error] [<0.3878.1>] {error_report,<0.22.0>,
{<0.3878.1>,supervisor_report,
[{supervisor,{local,couch_secondary_services}},
{errorContext,child_terminated},
{reason,{{nocatch,{invalid_json,<<"!!!">>}},
[{couch_os_process,prompt,2},
{couch_query_servers,'-start_doc_map/2-fun-0-',2},
{lists,foreach,2},
{couch_query_servers,start_doc_map,2},
{couch_view_updater,view_compute,2},
{couch_view_updater,update,1}]}},
{offender,[{pid,<0.3879.1>},
{name,view_manager},
{mfa,{couch_view,start_link,[]}},
{restart_type,permanent},
{shutdown,brutal_kill},
{child_type,worker}]}]}}
[Fri, 15 May 2009 12:29:50 GMT] [error] [<0.4645.1>] Uncaught error in HTTP
request: {error,
{case_clause,
{{nocatch,{invalid_json,<<"!!!">>}},
[{couch_os_process,prompt,2},
{couch_query_servers,
'-start_doc_map/2-fun-0-',2},
{lists,foreach,2},
{couch_query_servers,start_doc_map,2},
{couch_view_updater,view_compute,2},
{couch_view_updater,update,1}]}}}
Any help will be greatly appreciated.
Thanks.
- Debasish
On Fri, May 15, 2009 at 1:25 PM, Debasish Ghosh <[email protected]>wrote:
> Thanks for the response. I have removed buffered stream calls .. the
> process time out error is no more. But now I am getting an illegal JSON
> error as the following .. (from couch.log)
>
> ** Last message in was {'EXIT',<0.15838.0>,
> {{nocatch,{invalid_json,<<"!!!">>}},
> [{couch_os_process,prompt,2},
>
> {couch_query_servers,'-start_doc_map/2-fun-0-',2},
> {lists,foreach,2},
> {couch_query_servers,start_doc_map,2},
> {couch_view_updater,view_compute,2},
> {couch_view_updater,update,1}]}}
>
> The strange part is that the script runs ok when I run from the command
> prompt and supply inputs like ["reset"]\n etc. manually. Is there any way I
> can poke into what commands are actually being exchanged between CouchDB and
> the view server ?
>
> Thanks for the help.
> - Debasish
>
>
> On Thu, May 14, 2009 at 9:09 PM, Paul Davis
> <[email protected]>wrote:
>
>> The most likely cause is buffering. If you're not getting any input,
>> then I'm guessing that getLines.forEach is doing some buffering to try
>> and make reading from files faster. If you get one line and nothing
>> else, your stdout stream is probably buffered.
>>
>> HTH,
>> Paul Davis
>>
>> On Thu, May 14, 2009 at 8:33 AM, Debasish Ghosh
>> <[email protected]> wrote:
>> > Hi -
>> >
>> > I was trying to play around with query servers using Scala as the
>> language.
>> > I have registered Scala as the language in local.ini .. it shows up in
>> Futon
>> > as well. I have a Scala script registered that reads from the standard
>> input
>> > and writes into the standard output. Here is a snippet from the script
>> ..
>> >
>> > scala.io.Source.fromInputStream(System.in).getLines.foreach {l =>
>> > //.. expecting to get stuff like "add_fun", "map_doc", "reset" etc.
>> > here ..
>> >
>> > But I am not getting anything within this loop, though the process gets
>> > kicked off when the view server launches. After some time it comes out
>> with
>> > the exception ..
>> >
>> > {"error":"case_clause","reason":"{{nocatch,{os_process_error,\"OS
>> process
>> > timed out.\"}},\n [{couch_os_process,prompt,2},\n
>> > {couch_query_servers,'-start_doc_map/2-fun-0-',2},\n
>> {lists,foreach,2},\n
>> > {couch_query_servers,start_doc_map,2},\n
>> > {couch_view_updater,view_compute,2},\n
>> {couch_view_updater,update,1}]}"}
>> >
>> > Am I assuming anything which is not correct ? Please help.
>> >
>> > Thanks.
>> > - Debasish
>> >
>>
>
>