couchdb-dev mailing list archives

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

    [ https://issues.apache.org/jira/browse/COUCHDB-354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12712095#action_12712095
] 

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 http://127.0.0.1:5984/
{"couchdb":"Welcome","version":"0.10.0a777521"}

$ 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 http://127.0.0.1:5984/_log
       {trap_exit,true},
                 {status,running},
                 {heap_size,987},
                 {stack_size,23},
                 {reductions,751}],
                []]}}

[Fri, 22 May 2009 13:53:41 GMT] [error] [<0.44.0>] {error_report,<0.22.0>,
              {<0.44.0>,supervisor_report,
               [{supervisor,{local,couch_secondary_services}},
                {errorContext,child_terminated},
                {reason,{os_process_error,"OS process timed out."}},
                {offender,[{pid,<0.45.0>},
                           {name,view_manager},
                           {mfa,{couch_view,start_link,[]}},
                           {restart_type,permanent},
                           {shutdown,brutal_kill},
                           {child_type,worker}]}]}}

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

[Fri, 22 May 2009 13:53:50 GMT] [info] [<0.79.0>] 127.0.0.1 - - '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 1.8.1.16+nobinonly-0ubuntu1

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


> Ungraceful behaviour if view returns a function
> -----------------------------------------------
>
>                 Key: COUCHDB-354
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-354
>             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.


Mime
View raw message