Skip to content
Snippets Groups Projects
Commit c936709e authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Filesystem.Monitor: Improved robustness.

It seems ADT.Heap()->peek() sometimes can index the NULL value
(cf [bug 7644]). The most likely cause is that the last element
of the heap was removed by a different thread during the call.
Inhibit propagation of the error to the caller.

Work around for [bug 7644].
parent a2ca3c27
Branches
Tags
No related merge requests found
...@@ -1490,6 +1490,11 @@ int check(int|void max_wait, int|void max_cnt, ...@@ -1490,6 +1490,11 @@ int check(int|void max_wait, int|void max_cnt,
int cnt; int cnt;
int t = time(); int t = time();
if (sizeof(monitor_queue)) { if (sizeof(monitor_queue)) {
// NB: peek() can apparently in some circumstances throw errors.
// cf [bug 7644]. The likely cause being that a different
// thread removed the last element during the call. Make
// sure not to propagate the error to the caller.
mixed err = catch {
Monitor m; Monitor m;
while ((m = monitor_queue->peek()) && (m->next_poll <= t)) { while ((m = monitor_queue->peek()) && (m->next_poll <= t)) {
cnt += check_monitor(m); cnt += check_monitor(m);
...@@ -1504,6 +1509,10 @@ int check(int|void max_wait, int|void max_cnt, ...@@ -1504,6 +1509,10 @@ int check(int|void max_wait, int|void max_cnt,
} else { } else {
scan_cnt--; scan_cnt--;
} }
};
if (err) {
master()->handle_error(err);
}
} }
if (cnt || !scan_wait || !scan_cnt) { if (cnt || !scan_wait || !scan_cnt) {
if (ret_stats) { if (ret_stats) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment