nickva commented on a change in pull request #3329:
URL: https://github.com/apache/couchdb/pull/3329#discussion_r558510996
##########
File path: src/couch/test/eunit/couchdb_os_proc_pool.erl
##########
@@ -205,6 +208,46 @@ should_reduce_pool_on_idle_os_procs() ->
end).
+should_not_return_broken_process_to_the_pool() ->
+ ?_test(begin
+ config:set("query_server_config",
+ "os_process_soft_limit", "1", false),
+ ok = confirm_config("os_process_soft_limit", "1"),
+
+ config:set("query_server_config",
+ "os_process_limit", "1", false),
+ ok = confirm_config("os_process_limit", "1"),
+
+ DDoc = #doc{
+ id = <<"ddoc1">>,
+ revs = {1, [<<"abc">>]},
+ body = {[
+ {<<"language">>, <<"javascript">>},
+ {<<"views">>, {[
+ {<<"v1">>, {[
+ {<<"map">>, <<"function(doc) {emit(doc.value,1);}">>}
+ ]}}
+ ]}}
+ ]}
+ },
+ meck:reset(couch_os_process),
+
+ ?assertEqual(0, couch_proc_manager:get_proc_count()),
+ ok = couch_query_servers:with_ddoc_proc(DDoc, fun(_) -> ok end),
+ ?assertEqual(0, meck:num_calls(couch_os_process, stop, 1)),
+ ?assertEqual(1, couch_proc_manager:get_proc_count()),
+
+ ?assertError(bad, couch_query_servers:with_ddoc_proc(DDoc, fun(_) ->
+ error(bad)
+ end)),
+ ?assertEqual(1, meck:num_calls(couch_os_process, stop, 1)),
Review comment:
Good idea
##########
File path: src/couch/test/eunit/couchdb_os_proc_pool.erl
##########
@@ -205,6 +208,46 @@ should_reduce_pool_on_idle_os_procs() ->
end).
+should_not_return_broken_process_to_the_pool() ->
+ ?_test(begin
+ config:set("query_server_config",
+ "os_process_soft_limit", "1", false),
+ ok = confirm_config("os_process_soft_limit", "1"),
+
+ config:set("query_server_config",
+ "os_process_limit", "1", false),
+ ok = confirm_config("os_process_limit", "1"),
+
+ DDoc = #doc{
+ id = <<"ddoc1">>,
+ revs = {1, [<<"abc">>]},
+ body = {[
+ {<<"language">>, <<"javascript">>},
+ {<<"views">>, {[
+ {<<"v1">>, {[
+ {<<"map">>, <<"function(doc) {emit(doc.value,1);}">>}
+ ]}}
+ ]}}
+ ]}
+ },
+ meck:reset(couch_os_process),
+
+ ?assertEqual(0, couch_proc_manager:get_proc_count()),
+ ok = couch_query_servers:with_ddoc_proc(DDoc, fun(_) -> ok end),
+ ?assertEqual(0, meck:num_calls(couch_os_process, stop, 1)),
+ ?assertEqual(1, couch_proc_manager:get_proc_count()),
+
+ ?assertError(bad, couch_query_servers:with_ddoc_proc(DDoc, fun(_) ->
+ error(bad)
+ end)),
+ ?assertEqual(1, meck:num_calls(couch_os_process, stop, 1)),
+
+ ok = couch_query_servers:with_ddoc_proc(DDoc, fun(_) -> ok end),
Review comment:
We could just for completeness, though we already asserted that stop was
called to kill the one
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]