Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 68656 invoked from network); 25 Aug 2009 19:09:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Aug 2009 19:09:24 -0000 Received: (qmail 45921 invoked by uid 500); 25 Aug 2009 19:09:48 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 45861 invoked by uid 500); 25 Aug 2009 19:09:48 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 45851 invoked by uid 99); 25 Aug 2009 19:09:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Aug 2009 19:09:48 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of paul.joseph.davis@gmail.com designates 209.85.132.250 as permitted sender) Received: from [209.85.132.250] (HELO an-out-0708.google.com) (209.85.132.250) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Aug 2009 19:09:37 +0000 Received: by an-out-0708.google.com with SMTP id b2so1196459ana.5 for ; Tue, 25 Aug 2009 12:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=fnYaVUZye5aLST7kf6ON6kvCirebKyZQ5aCpTLmhAiQ=; b=qsTXJm941wEg2CIbejSMSI593sc2xVrDMAwGFb92AjzrrgR7FiF3uLHguR5wlpfVq0 0YIlsGZ2v1qXf2fEXsn8MLjTWW/S7OSV0nltkoK2NpHUM9ej77haHt04PK7yHX6kzolM rqQFul9QhhHhsuJnzuy+OcUx/AlRidI8kpksE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=gQyE54iszn7nOZyKVSx9hkBPdHePvuENagU2eMX/8v7SYl3HcDgvZ/Iar+uFIkbL4Z WhMatvfaeO6Uy7uDdX+1Iw0aaqbpZAyWuhBr3ZcR0vd84aH7g1SMlfP49ZlMxLeztxsp 3MZ7bWZRq8oTz2sNK+hok/llGqJIYdDutJcbM= MIME-Version: 1.0 Received: by 10.100.60.1 with SMTP id i1mr6539807ana.11.1251227356668; Tue, 25 Aug 2009 12:09:16 -0700 (PDT) In-Reply-To: References: Date: Tue, 25 Aug 2009 15:09:16 -0400 Message-ID: Subject: Re: Understanding couchdb error messages From: Paul Davis To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Tue, Aug 25, 2009 at 3:02 PM, Hadley Wickham wrote: > Hi all, > > Do you have any tips to offer on interpreting couch db error messages? > =A0For example, take the error below: > > =3DERROR REPORT=3D=3D=3D=3D 25-Aug-2009::13:58:08 =3D=3D=3D > ** Generic server <0.20641.8> terminating > ** Last message in was {'EXIT',<0.20640.8>, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {{badmatch, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<<"Cannot = encode 'undefined' value as JSON">>}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[{couch_query_serv= ers,reduce,3}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_view_group= ,'-init_group/4-fun-0-',4}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_btree,'-wr= ite_node/3-lc$^0/1-0-',3}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_btree,writ= e_node,3}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_btree,modi= fy_node,4}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_btree,quer= y_modify,4}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_btree,add_= remove,3}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_view_updat= er, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 '-write_c= hanges/4-lc$^3/1-3-',2}]}} > ** When Server state =3D=3D {file_descriptor,prim_file,{#Port<0.1471>,18}= } > ** Reason for termination =3D=3D > ** {{badmatch,<<"Cannot encode 'undefined' value as JSON">>}, > =A0 =A0[{couch_query_servers,reduce,3}, > =A0 =A0 {couch_view_group,'-init_group/4-fun-0-',4}, > =A0 =A0 {couch_btree,'-write_node/3-lc$^0/1-0-',3}, > =A0 =A0 {couch_btree,write_node,3}, > =A0 =A0 {couch_btree,modify_node,4}, > =A0 =A0 {couch_btree,query_modify,4}, > =A0 =A0 {couch_btree,add_remove,3}, > =A0 =A0 {couch_view_updater,'-write_changes/4-lc$^3/1-3-',2}]} > 1> [error] [<0.20641.8>] {error_report,<0.25.0>, > =A0 =A0{<0.20641.8>,crash_report, > =A0 =A0 [[{initial_call,{couch_file,init,['Argument__1']}}, > =A0 =A0 =A0 {pid,<0.20641.8>}, > =A0 =A0 =A0 {registered_name,[]}, > =A0 =A0 =A0 {error_info, > =A0 =A0 =A0 =A0 =A0 {exit, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 {{badmatch,<<"Cannot encode 'undefined' value= as JSON">>}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[{couch_query_servers,reduce,3}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_view_group,'-init_group/4-fun-0-',= 4}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_btree,'-write_node/3-lc$^0/1-0-',3= }, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_btree,write_node,3}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_btree,modify_node,4}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_btree,query_modify,4}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_btree,add_remove,3}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {couch_view_updater,'-write_changes/4-lc$= ^3/1-3-',2}]}, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 [{gen_server,terminate,6},{proc_lib,init_p_do= _apply,3}]}}, > =A0 =A0 =A0 {ancestors, > =A0 =A0 =A0 =A0 =A0 [<0.20640.8>,couch_view,couch_secondary_services,couc= h_server_sup, > =A0 =A0 =A0 =A0 =A0 =A0<0.1.0>]}, > =A0 =A0 =A0 {messages,[]}, > =A0 =A0 =A0 {links,[#Port<0.1471>]}, > =A0 =A0 =A0 {dictionary,[]}, > =A0 =A0 =A0 {trap_exit,true}, > =A0 =A0 =A0 {status,running}, > =A0 =A0 =A0 {heap_size,1597}, > =A0 =A0 =A0 {stack_size,24}, > =A0 =A0 =A0 {reductions,462029}], > =A0 =A0 =A0[]]}} > > I can see that the basic problem appears to be "Cannot encode > 'undefined' value as JSON", but how can I tell which view is having > this problem, and which particular record is causing the problem? > > This should be really easy for me to figure out given that I only have > two views. I'm using one to create a index so I can look articles up > by keywords: > > map: function(doc) { > =A0for(i in doc.keywords) { > =A0 =A0emit(doc.keywords[i], null) > =A0} > } > > and the other just to count the number of articles that use a keyword: > > map: function(doc) { > =A0for(i in doc.keywords) { > =A0 =A0emit(doc.keywords[i], 1) > =A0} > } > > reduce: function(keys, values, rereduce) { > =A0sum(values) > } > > What am I doing wrong? > > Thanks! > > Hadley > -- > http://had.co.nz/ > The important bit: <<"Cannot encode 'undefined' value as JSON">> Means we're missing something in the view server, but the underlying cause is that you're accessing a JavaScript member that doesn't exist. Something like: var f =3D {"stuff": "here"}; emit(f.not_an_member, null); Both of your maps look all right though. Is that all there is, or is there something else that wasn't pasted? HTH, Paul Davis