Here's my map function:
{
if (doc.type == 'in') {
for (i=0;i<doc.rcpts.length;i++) {
emit([doc.rcpts[i], doc.date], doc);
}
}
}
"},"by_from_hdr":{"map":"function(doc) {
if (doc.type == 'in') {
for (i=0;i<doc.rcpts.length;i++) {
emit([doc.rcpts[i], doc.from_hdr], doc);
}
}
}
"},"by_score":{"map":"function(doc) {
if (doc.type == 'in') {
for (i=0;i<doc.rcpts.length;i++) {
emit([doc.rcpts[i], doc.score], doc);
}
}
}
"},"by_subject_hdr":{"map":"function(doc) {
if (doc.type == 'in') {
for (i=0;i<doc.rcpts.length;i++) {
emit([doc.rcpts[i], doc.subject_hdr], doc);
}
}
}
"}}}
Didn't get a chance to page through futon. There are 5M records to get
through, and it occurs somewhere about 7/10th of the way through, so it'd take
me a long time to click so much.
By the way, we are running this couch instance with the database on an NFS
mount and the host server has been rebooted a few times. So I could imagine
couch thinking it has written when it really hasn't leading to this problem.
So I don't think this is really a couch issue, but it'd be nice for it to be
robust in these situations.
-----Original Message-----
From: Paul Davis [mailto:[email protected]]
Sent: Thursday, July 23, 2009 11:49 AM
To: [email protected]
Subject: Re: something wrong with my views
Also, could you paste your map functions?
And can you page through Futon just fine? It sounds like a malformed
document got into the database. I'd hazard a guess and say that it
looks like something with a malformed attachment judging from the
couch_stream in the traceback.
Can you page through futon without errors?
On Thu, Jul 23, 2009 at 2:22 PM, Peter Hsu<[email protected]> wrote:
> Ok, so I added some logging to my view generation to find the offending doc.
>
> However, I have no way to access the document. When I try to get to it
> through the web, all I get is:
> {"error":"unknown_error","reason":"badarg"}
> I get a similar error through futon.
>
> I'd like to get to the doc to see what is causing it instead of just
> deleting it. Any suggestions?
>
> On Jul 21, 2009, at 1:14 AM, Chris Anderson wrote:
>
>> On Mon, Jul 20, 2009 at 4:28 PM, Peter Hsu<[email protected]> wrote:
>>>
>>> Left some of the output out.
>>>
>>> Am I running into a bad doc that is killing my view generation? How
>>> would I track it down?
>>>
>>
>> You'd probably need to add a ?LOG_DEBUG statement to the code before
>> the error occurs. Maybe logging the docid would be most helpful.
>>
>> I'd add the logging here:
>>
>> {couch_view_updater,process_doc,3},
>>
>> HTH
>>
>>
>>> From: Peter Hsu
>>> Sent: Monday, July 20, 2009 4:26 PM
>>> To: [email protected]
>>> Subject: something wrong with my views
>>>
>>> They keep generating. Here's what my logs say. I'm not sure what the
>>> error is... any advice?
>>>
>>>
>>> [Mon, 20 Jul 2009 23:18:28 GMT] [error] [<0.76.0>] ** Generic server
>>> <0.76.0> terminating
>>> ** Last message in was {'EXIT',<0.78.0>,
>>> {badarg,
>>> [{erlang,binary_to_term,[<<>>]},
>>> {couch_stream,read_term,2},
>>> {couch_db,make_doc,5},
>>> {couch_db,open_doc_int,3},
>>> {couch_db,open_doc,3},
>>> {couch_view_updater,process_doc,3},
>>> {couch_view_updater,'-update/1-fun-0-',5},
>>> {couch_btree,stream_kv_node2,7}]}}
>>> ** When Server state ==
>>> {group_state,undefined,<<"small_apple_quarantine">>,
>>> {view,"/couch/db",<<"small_apple_quarantine">>,
>>> <<"_design/meta_in">>},
>>> {group,view,
>>>
>>> <<86,59,253,191,11,74,84,198,183,162,209,247,233,182,
>>> 208,6>>,
>>> {db,<0.63.0>,<0.64.0>,nil,<<"1248130919356767">>,
>>> <0.62.0>,<0.66.0>,
>>> {db_header,1,8364622,
>>> {124063532512,6885},
>>> {124063892675,{978441,3693076}},
>>> {124063890009,4671517},
>>> nil,0,nil,nil,1000},
>>> {stream,<0.65.0>,<0.62.0>},
>>> {btree,<0.62.0>,
>>> {124063962445,{978442,3693076}},
>>> #Fun<couch_db_updater.6.65324130>,
>>> #Fun<couch_db_updater.7.128706042>,
>>> #Fun<couch_db_updater.5.93235209>,
>>> #Fun<couch_db_updater.8.66861196>},
>>> {btree,<0.62.0>,
>>> {124063960073,4671518},
>>> #Fun<couch_db_updater.9.123705295>,
>>> #Fun<couch_db_updater.10.30133661>,
>>> #Fun<couch_btree.5.112258129>,
>>> #Fun<couch_db_updater.11.51444615>},
>>> {btree,<0.62.0>,nil,#Fun<couch_btree.0.23070627>,
>>> #Fun<couch_btree.1.117278773>,
>>> #Fun<couch_btree.2.112258129>,nil},
>>> 8364623,<<"small_apple_quarantine">>,
>>>
>>> "/couch/db/small_apple_quarantine.couch",[],[],nil,
>>> {user_ctx,null,[]},
>>> #Ref<0.0.0.328>,1000},
>>>
>>> <0.77.0>,<<"_design/meta_in">>,<<"javascript">>,[],
>>> [{view,0,
>>> [<<"by_subject_hdr">>],
>>> <<"function(doc) { \n if (doc.type == 'in')
>>> {\n for (i=0;i<doc.rcpts.length;i++) {\n emit([doc.rcpts[i
>>> ], doc.subject_hdr], doc);\n }\n }\n}\n">>,
>>> {btree,<0.77.0>,
>>> {113808894323,{1848073,[]}},
>>> #Fun<couch_btree.3.23070627>,
>>> #Fun<couch_btree.4.117278773>,
>>> #Fun<couch_view.less_json_keys.2>,
>>> #Fun<couch_view_group.7.51928864>},
>>> []},
>>> {view,1,
>>> [<<"by_from_hdr">>],
>>> <<"function(doc) { \n if (doc.type == 'in')
>>> {\n for (i=0;i<doc.rcpts.length;i++) {\n emit([doc.rcpts[i
>>> ], doc.from_hdr], doc);\n }\n }\n}\n">>,
>>> {btree,<0.77.0>,
>>> {113894873344,{1848073,[]}},
>>> #Fun<couch_btree.3.23070627>,
>>> #Fun<couch_btree.4.117278773>,
>>> #Fun<couch_view.less_json_keys.2>,
>>> #Fun<couch_view_group.7.51928864>},
>>> []},
>>> {view,2,
>>> [<<"by_score">>],
>>> <<"function(doc) { \n if (doc.type == 'in')
>>> {\n for (i=0;i<doc.rcpts.length;i++) {\n emit([doc.rcpts[i
>>> ], doc.score], doc);\n }\n }\n}\n">>,
>>> {btree,<0.77.0>,
>>> {113954480508,{1848073,[]}},
>>> #Fun<couch_btree.3.23070627>,
>>> #Fun<couch_btree.4.117278773>,
>>> #Fun<couch_view.less_json_keys.2>,
>>> #Fun<couch_view_group.7.51928864>},
>>> []},
>>> {view,3,
>>> [<<"by_date">>],
>>> <<"function(doc) { \n if (doc.type == 'in')
>>> {\n for (i=0;i<doc.rcpts.length;i++) {\n emit([doc.rcpts[i
>>> ], doc.date], doc);\n }\n }\n}\n">>,
>>> {btree,<0.77.0>,
>>> {113960448693,{1848073,[]}},
>>> #Fun<couch_btree.3.23070627>,
>>> #Fun<couch_btree.4.117278773>,
>>> #Fun<couch_view.less_json_keys.2>,
>>> #Fun<couch_view_group.7.51928864>},
>>> []}],
>>> {btree,<0.77.0>,
>>> {113726936549,[]},
>>> #Fun<couch_btree.0.23070627>,
>>> #Fun<couch_btree.1.117278773>,
>>> #Fun<couch_btree.2.112258129>,nil},
>>> 8154777,0,nil,nil},
>>> <0.78.0>,false,[]}
>>> ** Reason for termination ==
>>> ** {badarg,[{erlang,binary_to_term,[<<>>]},
>>> {couch_stream,read_term,2},
>>> {couch_db,make_doc,5},
>>> {couch_db,open_doc_int,3},
>>> {couch_db,open_doc,3},
>>> {couch_view_updater,process_doc,3},
>>> {couch_view_updater,'-update/1-fun-0-',5},
>>> {couch_btree,stream_kv_node2,7}]}
>>>
>>> ** Reason for termination ==
>>> ** {badarg,[{erlang,binary_to_term,[<<>>]},
>>> {couch_stream,read_term,2},
>>> {couch_db,make_doc,5},
>>> {couch_db,open_doc_int,3},
>>> {couch_db,open_doc,3},
>>> {couch_view_updater,process_doc,3},
>>> {couch_view_updater,'-update/1-fun-0-',5},
>>> {couch_btree,stream_kv_node2,7}]}
>>>
>>>
>>> [Mon, 20 Jul 2009 23:18:28 GMT] [error] [<0.76.0>]
>>> {error_report,<0.22.0>,
>>> {<0.76.0>,crash_report,
>>> [[{pid,<0.76.0>},
>>> {registered_name,[]},
>>> {error_info,
>>> {exit,
>>> {badarg,
>>> [{erlang,binary_to_term,[<<>>]},
>>> {couch_stream,read_term,2},
>>> {couch_db,make_doc,5},
>>> {couch_db,open_doc_int,3},
>>> {couch_db,open_doc,3},
>>> {couch_view_updater,process_doc,3},
>>> {couch_view_updater,'-update/1-fun-0-',5},
>>> {couch_btree,stream_kv_node2,7}]},
>>> [{gen_server,terminate,6},{proc_lib,init_p_do_apply,3}]}},
>>> {initial_call,{couch_view_group,init,['Argument__1']}},
>>> {ancestors,
>>> [couch_view,couch_secondary_services,couch_server_sup,<0.1.0>]},
>>> {messages,[]},
>>> {links,[<0.77.0>,<0.45.0>]},
>>> {dictionary,[]},
>>> {trap_exit,true},
>>> {status,running},
>>> {heap_size,987},
>>> {stack_size,23},
>>> {reductions,96977}],
>>> []]}}
>>>
>>> [Mon, 20 Jul 2009 23:18:28 GMT] [error] [<0.77.0>] ** Generic server
>>> <0.77.0> terminating
>>> ** Last message in was {'EXIT',<0.76.0>,
>>> {badarg,
>>> [{erlang,binary_to_term,[<<>>]},
>>> {couch_stream,read_term,2},
>>> {couch_db,make_doc,5},
>>> {couch_db,open_doc_int,3},
>>> {couch_db,open_doc,3},
>>> {couch_view_updater,process_doc,3},
>>> {couch_view_updater,'-update/1-fun-0-',5},
>>> {couch_btree,stream_kv_node2,7}]}}
>>> ** When Server state == {file_descriptor,prim_file,{#Port<0.1030>,16}}
>>> ** Reason for termination ==
>>> ** {badarg,[{erlang,binary_to_term,[<<>>]},
>>> {couch_stream,read_term,2},
>>> {couch_db,make_doc,5},
>>> {couch_db,open_doc_int,3},
>>> {couch_db,open_doc,3},
>>> {couch_view_updater,process_doc,3},
>>> {couch_view_updater,'-update/1-fun-0-',5},
>>> {couch_btree,stream_kv_node2,7}]}
>>>
>>>
>>> [Mon, 20 Jul 2009 23:18:28 GMT] [error] [<0.77.0>]
>>> {error_report,<0.22.0>,
>>> {<0.77.0>,crash_report,
>>> [[{pid,<0.77.0>},
>>> {registered_name,[]},
>>> {error_info,
>>> {exit,
>>> {badarg,
>>> [{erlang,binary_to_term,[<<>>]},
>>> {couch_stream,read_term,2},
>>> {couch_db,make_doc,5},
>>> {couch_db,open_doc_int,3},
>>> {couch_db,open_doc,3},
>>> {couch_view_updater,process_doc,3},
>>> {couch_view_updater,'-update/1-fun-0-',5},
>>> {couch_btree,stream_kv_node2,7}]},
>>> [{gen_server,terminate,6},{proc_lib,init_p_do_apply,3}]}},
>>> {initial_call,{couch_file,init,['Argument__1']}},
>>> {ancestors,
>>> [<0.76.0>,couch_view,couch_secondary_services,couch_server_sup,
>>> <0.1.0>]},
>>> {messages,[]},
>>> {links,[#Port<0.1030>]},
>>> {dictionary,[]},
>>> {trap_exit,true},
>>> {status,running},
>>> {heap_size,987},
>>> {stack_size,23},
>>>
>>
>>
>>
>> --
>> Chris Anderson
>> http://jchrisa.net
>> http://couch.io
>