ad-hoc-views fails w/ cljs views #4

Closed
sritchie opened this Issue Mar 20, 2012 · 4 comments

Projects

None yet

2 participants

@sritchie
Collaborator

Here's my function:

(c/with-db local-db
  (c/ad-hoc-view
   (c/view-server-fns :cljs
                      {:cake {:map (fn [doc]
                                     (js/emit (aget doc "_id") nil))}})))

And here's the error I get from CouchDB:

=ERROR REPORT==== 20-Mar-2012::07:30:58 ===
** Generic server <0.10146.0> terminating 
** Last message in was {'EXIT',<0.10145.0>,
                               {<<"compilation_error">>,
                                <<"Expression does not eval to a function. ((new String(\"undefined\")))">>}}
** When Server state == {file,{file_descriptor,prim_file,{#Port<0.2401>,18}},
                              0,51}
** Reason for termination == 
** {<<"compilation_error">>,
    <<"Expression does not eval to a function. ((new String(\"undefined\")))">>}
[error] [<0.10146.0>] {error_report,<0.30.0>,
                       {<0.10146.0>,crash_report,
                        [[{initial_call,{couch_file,init,['Argument__1']}},
                          {pid,<0.10146.0>},
                          {registered_name,[]},
                          {error_info,
                           {exit,
                            {<<"compilation_error">>,
                             <<"Expression does not eval to a function. ((new String(\"undefined\")))">>},
                            [{gen_server,terminate,6,
                              [{file,"gen_server.erl"},{line,737}]},
                             {proc_lib,init_p_do_apply,3,
                              [{file,"proc_lib.erl"},{line,227}]}]}},
                          {ancestors,[<0.10145.0>,<0.10144.0>]},
                          {messages,[{'EXIT',<0.10148.0>,shutdown}]},
                          {links,[]},
                          {dictionary,[]},
                          {trap_exit,true},
                          {status,running},
                          {heap_size,377},
                          {stack_size,24},
                          {reductions,1321}],
                         []]}}

=CRASH REPORT==== 20-Mar-2012::07:30:58 ===
  crasher:
    initial call: couch_file:init/1
    pid: <0.10146.0>
    registered_name: []
    exception exit: {<<"compilation_error">>,
                     <<"Expression does not eval to a function. ((new String(\"undefined\")))">>}
      in function  gen_server:terminate/6 (gen_server.erl, line 737)
    ancestors: [<0.10145.0>,<0.10144.0>]
    messages: [{'EXIT',<0.10148.0>,shutdown}]
    links: []
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 377
    stack_size: 24
    reductions: 1321
  neighbours:
[info] [<0.10125.0>] 127.0.0.1 - - 'POST' /paddleguru/_temp_view 500
@cemerick
Collaborator

Confirmed. Decidedly different than the other issue from irc (which I haven't been able to verify, BTW): the "undefined" bit is obviously wrong.

I'll see what I can find; FWIW, ad-hoc views are (AFAIK) on the chopping block for some future rev of couchdb (they aren't practical in Cloudant/bigcouch-style clustered environments).

@sritchie
Collaborator

I verified the issue on IRC! It has to do with AOT. I'm AOT compiling my main namespace, which transitively AOT compiles the cljs compiler (after a couple of hops). That breaks because of this bug:

http://dev.clojure.org/jira/browse/CLJ-130

The solution for now is to rm -rf classes/cljs after the AOT compilation takes place. Pretty janky, but at least it gets the job done.

@cemerick
Collaborator

Fixing AOT default transitivity is probably an easier / more likely fix, though that's long-standing too:

http://dev.clojure.org/jira/browse/CLJ-130

Thanks for chasing that down.

@cemerick
Collaborator
cemerick commented May 7, 2012

Closing this now; note that ClojureScript view functionality has been rolled into Clutch proper.

@cemerick cemerick closed this May 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment