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/11/28 19:38:20 UTC
[GitHub] davisp commented on a change in pull request #1182: fixed race
is_idle
davisp commented on a change in pull request #1182: fixed race is_idle
URL: https://github.com/apache/couchdb/pull/1182#discussion_r237231050
##########
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:
This doesn't pass my smell test. Using ets tables as locks has got to be asking for trouble. Between the system limit on tables and no guaranteed cleanup that's a bunch of bad behaviors just waiting to happen.
----------------------------------------------------------------
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