Repository: apache/couchdb

Issue #565: should_not_remember_docs_in_index_after_backup_restore...*failed*
Created: 2017-06-02T23:53:19Z
Expected and Current Behaviour
Usually the couchdb_views_tests test should_not_remember_docs_in_index_after_backup_restore passes. Sometimes it fails.
Environment: Travis, Erlang 18.3
Makefile output:
  Upgrade and bugs related tests
    couchdb_views_tests:159: should_not_remember_docs_in_index_after_backup_restore...*failed*
in function couchdb_views_tests:'-query_view/4-fun-0-'/2 (test/couchdb_views_tests.erl, line 514)
in call from couchdb_views_tests:query_view/4 (test/couchdb_views_tests.erl, line 514)
in call from couchdb_views_tests:'-should_not_remember_docs_in_index_after_backup_restore/1-fun-8-'/1 (test/couchdb_views_tests.erl, line 173)
**error:{assertEqual,[{module,couchdb_views_tests},
              {line,514},
              {expression,"Code"},
              {expected,200},
              {value,500}]}
  output:<<"">>

couch.log output:
[info] 2017-06-02T23:12:29.470701Z nonode@nohost <0.29000.0> -------- alarm_handler: {set,{system_memory_high_watermark,[]}}
[info] 2017-06-02T23:12:29.508603Z nonode@nohost <0.29086.0> -------- Opening index for db: eunit-test-db-1496445149424073 idx: _design/foo sig: "5398c9ad12cad56d2228cc89a2770ddf"
[info] 2017-06-02T23:12:29.508945Z nonode@nohost <0.29089.0> -------- Starting index update for db: eunit-test-db-1496445149424073 idx: _design/foo
[info] 2017-06-02T23:12:29.517038Z nonode@nohost <0.29089.0> -------- Index update finished for db: eunit-test-db-1496445149424073 idx: _design/foo
[notice] 2017-06-02T23:12:29.517765Z nonode@nohost <0.29036.0> -------- 127.0.0.1 - - GET /eunit-test-db-1496445149424073/_design/foo/_view/bar 200
[info] 2017-06-02T23:12:29.518975Z nonode@nohost <0.29086.0> -------- Index shutdown by monitor notice for db: eunit-test-db-1496445149424073 idx: _design/foo
[info] 2017-06-02T23:12:29.519120Z nonode@nohost <0.29022.0> -------- db eunit-test-db-1496445149424073 died with reason shutdown
[info] 2017-06-02T23:12:29.519432Z nonode@nohost <0.29086.0> -------- Closing index for db: eunit-test-db-1496445149424073 idx: _design/foo sig: "5398c9ad12cad56d2228cc89a2770ddf" because normal
[error] 2017-06-02T23:12:29.520706Z nonode@nohost <0.29037.0> -------- Uncaught error in HTTP request: {error,{badmatch,{'EXIT',noproc}}}
[info] 2017-06-02T23:12:29.522215Z nonode@nohost <0.29037.0> -------- Stacktrace: [{couch_file,pread_binary,2,[{file,"src/couch_file.erl"},{line,168}]},{couch_file,pread_term,2,[{file,"src/couch_file.erl"},{line,156}]},{couch_btree,get_node,2,[{file,"src/couch_btree.erl"},{line,423}]},{couch_btree,lookup,3,[{file,"src/couch_btree.erl"},{line,282}]},{couch_btree,lookup,2,[{file,"src/couch_btree.erl"},{line,272}]},{couch_db,get_full_doc_info,2,[{file,"src/couch_db.erl"},{line,286}]},{couch_db,open_doc_int,3,[{file,"src/couch_db.erl"},{line,1366}]},{couch_db,open_doc,3,[{file,"src/couch_db.erl"},{line,189}]}]
[notice] 2017-06-02T23:12:29.522460Z nonode@nohost <0.29037.0> -------- 127.0.0.1 - - GET /eunit-test-db-1496445149424073/_design/foo/_view/bar 500
[error] 2017-06-02T23:12:29.522708Z nonode@nohost <0.29037.0> -------- httpd 500 error response:
 {"error":"badmatch","reason":"{'EXIT',noproc}"}
[info] 2017-06-02T23:12:29.532104Z nonode@nohost <0.7.0> -------- Application couch exited with reason: stopped
[info] 2017-06-02T23:12:29.533589Z nonode@nohost <0.29000.0> -------- alarm_handler: {clear,system_memory_high_watermark}

Possible Solution
Race condition in test? @davisp ?

Duplicate issue #589: eunit couchdb_views_tests errors with 500: {'EXIT',noproc}
Created: 2017-06-08T20:12:59Z
Current & Expected Behaviour
The couchdb_views_tests eunit test suite should always pass. Occasionally, it fails with a 500 error.
Environment: Jenkins, master, Ubuntu 16.04 with Erlang 18.3
Makefile output:
module 'couchdb_views_tests'
  View indexes cleanup
    couchdb_views_tests:214: should_have_two_indexes_alive_before_deletion...ok
    couchdb_views_tests:219: should_cleanup_index_file_after_ddoc_deletion...ok
    couchdb_views_tests:225: should_cleanup_all_index_files...ok
[os_mon] memory supervisor port (memsup): Erlang has closed
[os_mon] cpu supervisor port (cpu_sup): Erlang has closed
    [done in 0.242 s]
  View group db leaks
    couchdb_views_tests:228: couchdb_1138...[0.237 s] ok
    couchdb_views_tests:266: couchdb_1309...[0.037 s] ok
[os_mon] memory supervisor port (memsup): Erlang has closed
[os_mon] cpu supervisor port (cpu_sup): Erlang has closed
    [done in 0.339 s]
  View group shutdown
    couchdb_views_tests:315: couchdb_1283...[0.158 s] ok
[os_mon] memory supervisor port (memsup): Erlang has closed
[os_mon] cpu supervisor port (cpu_sup): Erlang has closed
    [done in 0.161 s]
  Upgrade and bugs related tests
    couchdb_views_tests:159: should_not_remember_docs_in_index_after_backup_restore...*failed*
in function couchdb_views_tests:'-query_view/4-fun-0-'/2 (test/couchdb_views_tests.erl, line 527)
in call from couchdb_views_tests:query_view/4 (test/couchdb_views_tests.erl, line 527)
in call from couchdb_views_tests:'-should_not_remember_docs_in_index_after_backup_restore/1-fun-8-'/1 (test/couchdb_views_tests.erl, line 173)
**error:{assertEqual,[{module,couchdb_views_tests},
              {line,527},
              {expression,"Code"},
              {expected,200},
              {value,500}]}
  output:<<"">>

[os_mon] memory supervisor port (memsup): Erlang has closed
[os_mon] cpu supervisor port (cpu_sup): Erlang has closed
    [done in 0.071 s]

couch.log output:
[info] 2017-06-08T18:34:25.819709Z nonode@nohost <0.24082.0> -------- Opening index for db: eunit-test-db-1496946865766965 idx: _design/foo sig: "5398c9ad12cad56d2228cc89a2770ddf"
[info] 2017-06-08T18:34:25.820150Z nonode@nohost <0.24085.0> -------- Starting index update for db: eunit-test-db-1496946865766965 idx: _design/foo
[info] 2017-06-08T18:34:25.825651Z nonode@nohost <0.24085.0> -------- Index update finished for db: eunit-test-db-1496946865766965 idx: _design/foo
[notice] 2017-06-08T18:34:25.826205Z nonode@nohost <0.24032.0> -------- 127.0.0.1 - - GET /eunit-test-db-1496946865766965/_design/foo/_view/bar 200
[info] 2017-06-08T18:34:25.826998Z nonode@nohost <0.24018.0> -------- db eunit-test-db-1496946865766965 died with reason shutdown
[info] 2017-06-08T18:34:25.827066Z nonode@nohost <0.24082.0> -------- Index shutdown by monitor notice for db: eunit-test-db-1496946865766965 idx: _design/foo
[error] 2017-06-08T18:34:25.831129Z nonode@nohost <0.24033.0> -------- Uncaught error in HTTP request: {error,{badmatch,{'EXIT',noproc}}}
[info] 2017-06-08T18:34:25.831593Z nonode@nohost <0.24082.0> -------- Closing index for db: eunit-test-db-1496946865766965 idx: _design/foo sig: "5398c9ad12cad56d2228cc89a2770ddf" because normal
[info] 2017-06-08T18:34:25.831969Z nonode@nohost <0.24033.0> -------- Stacktrace: [{couch_file,pread_binary,2,[{file,"src/couch_file.erl"},{line,169}]},{couch_file,pread_term,2,[{file,"src/couch_file.erl"},{line,157}]},{couch_btree,get_node,2,[{file,"src/couch_btree.erl"},{line,434}]},{couch_btree,lookup,3,[{file,"src/couch_btree.erl"},{line,284}]},{couch_btree,lookup,2,[{file,"src/couch_btree.erl"},{line,274}]},{couch_db,get_full_doc_info,2,[{file,"src/couch_db.erl"},{line,286}]},{couch_db,open_doc_int,3,[{file,"src/couch_db.erl"},{line,1366}]},{couch_db,open_doc,3,[{file,"src/couch_db.erl"},{line,189}]}]
[notice] 2017-06-08T18:34:25.832259Z nonode@nohost <0.24033.0> -------- 127.0.0.1 - - GET /eunit-test-db-1496946865766965/_design/foo/_view/bar 500
[error] 2017-06-08T18:34:25.832512Z nonode@nohost <0.24033.0> -------- httpd 500 error response:
 {"error":"badmatch","reason":"{'EXIT',noproc}"}
[info] 2017-06-08T18:34:25.842468Z nonode@nohost <0.7.0> -------- Application couch exited with reason: stopped

Possible Solution
Is this another case where the monitor shuts down too early?

Closing comment (2017-06-09T23:12:46Z): Sorry, my mistake. This is a duplicate of #565 so I'll close this one.