Branch: Tag:

2016-02-09

2016-02-09 13:11:28 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Filesystem.Monitor: Improved robustness.

It seems ADT.Heap()->peek() sometimes can index the NULL value
(cf [bug 7644 (#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 (#7644)].

1490:    int cnt;    int t = time();    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;    while ((m = monitor_queue->peek()) && (m->next_poll <= t)) {    cnt += check_monitor(m);
1504:    } else {    scan_cnt--;    } +  }; +  if (err) { +  master()->handle_error(err);    } -  +  }    if (cnt || !scan_wait || !scan_cnt) {    if (ret_stats) {    ret_stats->num_monitors = sizeof(monitors);