You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Ivan Bodunov <iv...@gmail.com> on 2010/04/16 02:18:09 UTC

Filters in Erlang broken

Hi,

After I wrote my filter in JavaScript I decided to rewrite it in Erlang and
faced some problems.
Even the simplest possible filter written in Erlang causes crashes in
CouchDB.

Filter is
    "filters": { "foo": "fun({Doc},Req) -> true end." }

Command to trigger the filter is
    # curl -X GET http://localhost:5984/mytemp/_changes?filter=erl/foo

Following link contains the crash report:
http://friendpaste.com/6eFpPOtTaaSRiXEvaUEmrZ

CouchDB 0.11 on Mac.

Ivan

Re: Filters in Erlang broken

Posted by Filipe David Manana <fd...@gmail.com>.
You need a 3rd argument in your erlang filter function. This 3rd argument is
the user context.

I created a ticket at https://issues.apache.org/jira/browse/COUCHDB-740 with
a patch attached to make that third parameter optional and add a test.
I dunno if it should be made optional or stay as mandatory.



On Fri, Apr 16, 2010 at 10:41 AM, Filipe David Manana <fd...@gmail.com>wrote:

> If nobody is already working on a fix, I can spend some time on it.
>
>
> On Fri, Apr 16, 2010 at 4:49 AM, Paul Davis <pa...@gmail.com>wrote:
>
>> Someone refactored couch_native_process.erl and forgot to update the
>> design doc interaction thinger with random functions.
>>
>> In other words, it expects an argument like {_, Func} but gets
>> ["filters", "foo"] IIRC.
>>
>> On Thu, Apr 15, 2010 at 8:18 PM, Ivan Bodunov <iv...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > After I wrote my filter in JavaScript I decided to rewrite it in Erlang
>> and
>> > faced some problems.
>> > Even the simplest possible filter written in Erlang causes crashes in
>> > CouchDB.
>> >
>> > Filter is
>> >    "filters": { "foo": "fun({Doc},Req) -> true end." }
>> >
>> > Command to trigger the filter is
>> >    # curl -X GET http://localhost:5984/mytemp/_changes?filter=erl/foo
>> >
>> > Following link contains the crash report:
>> > http://friendpaste.com/6eFpPOtTaaSRiXEvaUEmrZ
>> >
>> > CouchDB 0.11 on Mac.
>> >
>> > Ivan
>> >
>>
>
>
>
> --
> Filipe David Manana,
> fdmanana@gmail.com
>
> "Reasonable men adapt themselves to the world.
> Unreasonable men adapt the world to themselves.
> That's why all progress depends on unreasonable men."
>
>


-- 
Filipe David Manana,
fdmanana@gmail.com

"Reasonable men adapt themselves to the world.
Unreasonable men adapt the world to themselves.
That's why all progress depends on unreasonable men."

Re: Filters in Erlang broken

Posted by Filipe David Manana <fd...@gmail.com>.
If nobody is already working on a fix, I can spend some time on it.

On Fri, Apr 16, 2010 at 4:49 AM, Paul Davis <pa...@gmail.com>wrote:

> Someone refactored couch_native_process.erl and forgot to update the
> design doc interaction thinger with random functions.
>
> In other words, it expects an argument like {_, Func} but gets
> ["filters", "foo"] IIRC.
>
> On Thu, Apr 15, 2010 at 8:18 PM, Ivan Bodunov <iv...@gmail.com>
> wrote:
> > Hi,
> >
> > After I wrote my filter in JavaScript I decided to rewrite it in Erlang
> and
> > faced some problems.
> > Even the simplest possible filter written in Erlang causes crashes in
> > CouchDB.
> >
> > Filter is
> >    "filters": { "foo": "fun({Doc},Req) -> true end." }
> >
> > Command to trigger the filter is
> >    # curl -X GET http://localhost:5984/mytemp/_changes?filter=erl/foo
> >
> > Following link contains the crash report:
> > http://friendpaste.com/6eFpPOtTaaSRiXEvaUEmrZ
> >
> > CouchDB 0.11 on Mac.
> >
> > Ivan
> >
>



-- 
Filipe David Manana,
fdmanana@gmail.com

"Reasonable men adapt themselves to the world.
Unreasonable men adapt the world to themselves.
That's why all progress depends on unreasonable men."

Re: Filters in Erlang broken

Posted by Paul Davis <pa...@gmail.com>.
Someone refactored couch_native_process.erl and forgot to update the
design doc interaction thinger with random functions.

In other words, it expects an argument like {_, Func} but gets
["filters", "foo"] IIRC.

On Thu, Apr 15, 2010 at 8:18 PM, Ivan Bodunov <iv...@gmail.com> wrote:
> Hi,
>
> After I wrote my filter in JavaScript I decided to rewrite it in Erlang and
> faced some problems.
> Even the simplest possible filter written in Erlang causes crashes in
> CouchDB.
>
> Filter is
>    "filters": { "foo": "fun({Doc},Req) -> true end." }
>
> Command to trigger the filter is
>    # curl -X GET http://localhost:5984/mytemp/_changes?filter=erl/foo
>
> Following link contains the crash report:
> http://friendpaste.com/6eFpPOtTaaSRiXEvaUEmrZ
>
> CouchDB 0.11 on Mac.
>
> Ivan
>