You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/01/15 18:43:29 UTC

[GitHub] [couchdb] davisp commented on a change in pull request #3329: Do not return broken processes to the query process pool

davisp commented on a change in pull request #3329:
URL: https://github.com/apache/couchdb/pull/3329#discussion_r558501958



##########
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:
       Seems like we should add an assertion that there are zero os processes here?

##########
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:
       I'm pretty sure the original bug required a second design doc to be sent to the process in this part to trigger the bug, should we do that to be sure? Should be able to just tweak the id or revs of DDoc.




----------------------------------------------------------------
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:
users@infra.apache.org