[MB-6653] [windows] Unable to update ddoc(1 bucket, single node) Created: 13/Sep/12  Updated: 10/Jan/13  Resolved: 19/Sep/12

Status: Closed
Project: Couchbase Server
Component/s: view-engine
Affects Version/s: None
Fix Version/s: 2.0-beta-2
Security Level: Public

Type: Bug Priority: Blocker
Reporter: Iryna Mironava Assignee: Filipe Manana
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment: single node windows server r2 2008

Attachments: GZip Archive single-node-windows.txt.tar.gz    

 Description   
steps to reproduce:
1. Create 3 ddocs
2. Keep updating them (adding views)

test to repro:
-t view.createdeleteview.CreateDeleteViewTests.test_view_ops_parallel,ddoc_ops=update,test_with_view=True,num_ddocs=4,num_views_per_ddoc=10,items=200000,start_view=2,views_to_ops=5

I had 9 views per ddoc when it started to fail updates with error:
[couchdb:error,2012-09-13T12:34:30.306,ns_1@10.1.3.135:<0.15724.7>:couch_log:error:42]Uncaught error in HTTP request: {exit,
                                 {noproc,
                                  {gen_server,call,
                                   ['capi_set_view_manager-default',
                                    {interactive_update,
                                     {doc,<<"_design/dev_ddoc1">>,
                                      {0,<<>>},
                                      <<"{\"views\":{\"views0\":{\"map\":\"function (doc) { emit(doc.age, doc.first_name);}\"},\"views1\":{\"map\":\"function (doc) { emit(doc.age, doc.first_name);}\"},\"views2\":{\"map\":\"function (doc) { emit(null, doc);}\"},\"views3\":{\"map\":\"function (doc) { emit(null, doc);}\"},\"views4\":{\"map\":\"function (doc) { emit(null, doc);}\"},\"views5\":{\"map\":\"function (doc) { emit(null, doc);}\"},\"views6\":{\"map\":\"function (doc) { emit(doc.age, doc.first_name);}\"},\"views7\":{\"map\":\"function (doc) { emit(doc.age, doc.first_name);}\"},\"views8\":{\"map\":\"function (doc) { emit(doc.age, doc.first_name);}\"},\"views9\":{\"map\":\"function (doc) { emit(doc.age, doc.first_name);}\"}}}">>,
                                      0,false,[]}},
                                    infinity]}}}
[couchdb:info,2012-09-13T12:34:30.306,ns_1@10.1.3.135:<0.15724.7>:couch_log:info:39]Stacktrace: [{gen_server,call,3},
             {capi_frontend,update_doc,3},
             {couch_httpd_db,update_doc,5},
             {couch_httpd,handle_request,6},
             {mochiweb_http,headers,5},
             {proc_lib,init_p_do_apply,3}]




 Comments   
Comment by Chiyoung Seo [ 13/Sep/12 ]
Filipe, this looks like your land.
Comment by Aleksey Kondratenko [ 13/Sep/12 ]
Request was made too early. We were still starting up
Comment by Aleksey Kondratenko [ 13/Sep/12 ]
Perhaps I was too quick. Looking at this more
Comment by Aleksey Kondratenko [ 13/Sep/12 ]
Badness happens because of some crash in couch:


[error_logger:error,2012-09-13T11:06:31.133,ns_1@10.1.3.135:error_logger:ale_error_logger_handler:log_msg:76]** Generic server couch_set_view_ddoc_cache terminating
** Last message in was {update_ddoc,<<"default">>,
                           {doc,<<"_design/dev_ddoc1">>,
                               {1,<<"4\nûJ">>},
                               {[{<<"views">>,
                                  {[{<<"views0">>,
                                     {[{<<"map">>,
                                        <<"function (doc) { emit(doc.age, doc.first_name);}">>}]}}]}}]},
                               0,false,[]},
                           197}
** When Server state == {state,1048576,2965,<0.243.0>}
** Reason for termination ==
** {{badmatch,false},
    [{couch_set_view_ddoc_cache,handle_call,3},
     {gen_server,handle_msg,5},
     {proc_lib,init_p_do_apply,3}]}

[couchdb:info,2012-09-13T11:06:31.133,ns_1@10.1.3.135:<0.4225.1>:couch_log:info:39]Compaction file still behind main file (update seq=6. compact update seq=5). Retrying.
[error_logger:error,2012-09-13T11:06:31.133,ns_1@10.1.3.135:error_logger:ale_error_logger_handler:log_report:72]
=========================CRASH REPORT=========================
  crasher:
    initial call: couch_set_view_ddoc_cache:init/1
    pid: <0.242.0>
    registered_name: couch_set_view_ddoc_cache
    exception exit: {{badmatch,false},
                     [{couch_set_view_ddoc_cache,handle_call,3},
                      {gen_server,handle_msg,5},
                      {proc_lib,init_p_do_apply,3}]}
      in function gen_server:terminate/6
    ancestors: [couch_secondary_services,couch_server_sup,cb_couch_sup,
                  ns_server_cluster_sup,<0.67.0>]
    messages: [{'EXIT',<0.243.0>,normal}]
    links: [<0.220.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 2584
    stack_size: 24
    reductions: 12959
  neighbours:


this leads to a bunch of failures inside ns_server and to this particular error
Comment by Filipe Manana [ 14/Sep/12 ]
gerrit change: http://review.couchbase.org/#/c/20858/
Comment by Thuan Nguyen [ 19/Sep/12 ]
Integrated in github-couchdb-preview #505 (See [http://qa.hq.northscale.net/job/github-couchdb-preview/505/])
    MB-6653 Fix ddoc cache cleanup on master database delete (Revision 34ae79b094c575990e445d302df2100bb3ecf662)

     Result = SUCCESS
Farshid Ghods :
Files :
* src/couch_set_view/src/couch_set_view_ddoc_cache.erl
* src/couch_set_view/test/02-old-index-cleanup.t
Generated at Sat Sep 20 14:29:33 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.