Repository: couchdb-couch Updated Branches: refs/heads/master 6e45e7b54 -> f9d0785c9
Add a configurable timeout for get_proc calls Previously the gen_server calls to couch_proc_manager/get_proc used a timeout of infinity. There are multiple places in the couch_proc_manager code path where that process can die without replying. With an infinity timeout the couch_query_server process would then hang around forever. This commit makes the gen_server call to get_proc use the value of couchdb/os_process_timeout as a timeout. Closes: COUCHDB-2425 COUCHDB-2426 This closes #31 Signed-off-by: Alexander Shorin <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/f9d0785c Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/f9d0785c Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/f9d0785c Branch: refs/heads/master Commit: f9d0785c93a6523e187ec4bcc8e487def5db8bd5 Parents: 6e45e7b Author: Mike Wallace <[email protected]> Authored: Wed Jan 14 18:39:44 2015 +0000 Committer: Alexander Shorin <[email protected]> Committed: Wed Jan 21 22:21:12 2015 +0300 ---------------------------------------------------------------------- src/couch_query_servers.erl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/f9d0785c/src/couch_query_servers.erl ---------------------------------------------------------------------- diff --git a/src/couch_query_servers.erl b/src/couch_query_servers.erl index c99f673..4882f9e 100644 --- a/src/couch_query_servers.erl +++ b/src/couch_query_servers.erl @@ -342,9 +342,12 @@ proc_set_timeout(Proc, Timeout) -> {Mod, Func} = Proc#proc.set_timeout_fun, apply(Mod, Func, [Proc#proc.pid, Timeout]). +get_os_process_timeout() -> + list_to_integer(config:get("couchdb", "os_process_timeout", "5000")). + get_ddoc_process(#doc{} = DDoc, DDocKey) -> % remove this case statement - case gen_server:call(couch_proc_manager, {get_proc, DDoc, DDocKey}, infinity) of + case gen_server:call(couch_proc_manager, {get_proc, DDoc, DDocKey}, get_os_process_timeout()) of {ok, Proc, {QueryConfig}} -> % process knows the ddoc case (catch proc_prompt(Proc, [<<"reset">>, {QueryConfig}])) of @@ -360,7 +363,7 @@ get_ddoc_process(#doc{} = DDoc, DDocKey) -> end. get_os_process(Lang) -> - case gen_server:call(couch_proc_manager, {get_proc, Lang}, infinity) of + case gen_server:call(couch_proc_manager, {get_proc, Lang}, get_os_process_timeout()) of {ok, Proc, {QueryConfig}} -> case (catch proc_prompt(Proc, [<<"reset">>, {QueryConfig}])) of true ->
