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 2018/12/09 16:55:30 UTC
[GitHub] obi458 commented on a change in pull request #1182: fixed race
is_idle
obi458 commented on a change in pull request #1182: fixed race is_idle
URL: https://github.com/apache/couchdb/pull/1182#discussion_r240044440
##########
File path: src/couch/src/couch_file.erl
##########
@@ -702,18 +703,25 @@ monitored_by_pids() ->
% System dbs aren't monitored by couch_stats_process_tracker
is_idle(#file{is_sys=true}) ->
case monitored_by_pids() of
- [] -> true;
+ [] -> lock(self());
_ -> false
end;
is_idle(#file{is_sys=false}) ->
Tracker = whereis(couch_stats_process_tracker),
case monitored_by_pids() of
- [] -> true;
- [Tracker] -> true;
+ [] -> lock(self());
+ [Tracker] -> lock(self());
[_] -> exit(tracker_monitoring_failed);
_ -> false
end.
+lock(Fd) -> try
+ ets:new(list_to_atom(pid_to_list(Fd)), [named_table]), true
Review comment:
I pulled a new one using register, without ets!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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
With regards,
Apache Git Services