couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <jch...@apache.org>
Subject Re: [jira] Updated: (COUCHDB-354) Ungraceful behaviour if view returns a function
Date Fri, 22 May 2009 21:08:02 GMT
I'm working on a unit test runner for the view server. I'm also adding
a more raw socket interface for lower view server memory consumption,
but I needed the view server tests to write that patch.

Once I have map and reduce working again with the new api, adding unit
tests for better error handling etc will be easy.

Here's what the spec file looks like now (work in progress):

http://github.com/jchris/couchdb/blob/53adcda5a7982e82af49c7dab86393fc62a77ccb/test/couchjs/spec/couchjs_spec.rb

I hope rspec works for people as a way to drive command line
interactions with the couchjs runner. I think we can end up with a
pretty maintainable test suite this way.

Chris

On Thu, May 21, 2009 at 2:44 AM, Brian Candler (JIRA) <jira@apache.org> wrote:
>
>     [ https://issues.apache.org/jira/browse/COUCHDB-354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
>
> Brian Candler updated COUCHDB-354:
> ----------------------------------
>
>    Attachment: barf.log
>
> The resulting barf
>
>> 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.
>
>



-- 
Chris Anderson
http://jchrisa.net
http://couch.io

Mime
View raw message