couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Candler (JIRA)" <>
Subject [jira] Commented: (COUCHDB-354) Ungraceful behaviour if view returns a function
Date Fri, 22 May 2009 14:04:45 GMT


Brian Candler commented on COUCHDB-354:

This is really odd: trunk still barfs for me. And what's especially odd is (a) your debug
log doesn't show *anything* wrong with that Javascript at all, and (b) your reduce output
is completely empty, not even 'key'=>null. Does all_docs show the documents? You're not
running the eep-0018 branch?

I get exactly the same:

$ curl

$ ruby ~/test_reduce_barf.rb

reduce across all says:
/var/lib/gems/1.8/gems/rest-client-0.9.2/lib/restclient/request.rb:144:in `process_result':
HTTP status code 500 (RestClient::RequestFailed)
	from /var/lib/gems/1.8/gems/rest-client-0.9.2/lib/restclient/request.rb:106:in `transmit'
	from /usr/lib/ruby/1.8/net/http.rb:543:in `start'
	from /var/lib/gems/1.8/gems/rest-client-0.9.2/lib/restclient/request.rb:103:in `transmit'
	from /var/lib/gems/1.8/gems/rest-client-0.9.2/lib/restclient/request.rb:36:in `execute_inner'
	from /var/lib/gems/1.8/gems/rest-client-0.9.2/lib/restclient/request.rb:28:in `execute'
	from /var/lib/gems/1.8/gems/rest-client-0.9.2/lib/restclient/request.rb:12:in `execute'
	from /var/lib/gems/1.8/gems/rest-client-0.9.2/lib/restclient.rb:57:in `get'
	from /home/brian/test_reduce_barf.rb:56

$ curl

[Fri, 22 May 2009 13:53:41 GMT] [error] [<0.44.0>] {error_report,<0.22.0>,
                {reason,{os_process_error,"OS process timed out."}},

[Fri, 22 May 2009 13:53:41 GMT] [info] [<0.78.0>] - - 'GET' /test/_design/test/_view/test

[Fri, 22 May 2009 13:53:50 GMT] [info] [<0.79.0>] - - 'GET' / 200

So maybe it's something platform related. On this particular machine, I am running:
* Ubuntu Jaunty
* erlang 1:12.b.5-dfsg-2
* libmozjs0d

(erlang and spidermonkey are both out-of-the-box Ubuntu components)

> Ungraceful behaviour if view returns a function
> -----------------------------------------------
>                 Key: COUCHDB-354
>                 URL:
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: JavaScript View Server
>         Environment: {"couchdb":"Welcome","version":"0.10.0a776990"}
>            Reporter: Brian Candler
>            Priority: Minor
>         Attachments: barf.log, test_reduce_barf.rb
> If a typo in a view definition causes it to return a function instead of a normal value:
> * the view server crashes
> * you get a huge Erlang barf in the log with worrying messages like "OS process timed
out" and "brutal kill"
> I got all this just by accidentally writing "vs.shift" instead of "vs.shift()"
> The fundamental problem is that a function cannot be serialised in toJSON, but the error
message is not helpful:
> OS Process Log Message: Error converting object to JSON: TypeError: {Array:function (v)
{var ... snip loads ... "Object"] is not a function
> When actually the problem is that the object I was trying to convert *was* a function
> I will attach some code which replicates this, and the barf generated.
> Of course this is entirely down to user error in an invalid map/reduce function. However
there's already a clean error for 'undefined', maybe this could be done for 'function' too
(or indeed any non-serialisable entity)

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message