Commit d54aa63d authored by Levin Zimmermann's avatar Levin Zimmermann

wcfs: Fix false alarm about faulty client whereas client just restarted

This patch fixes false alarm issue which tests were added in previous
patch 775adf73.
parent 775adf73
...@@ -2063,8 +2063,19 @@ func (wlink *WatchLink) shutdown(reason error) { ...@@ -2063,8 +2063,19 @@ func (wlink *WatchLink) shutdown(reason error) {
// kill client if shutdown is due to faulty pin handling // kill client if shutdown is due to faulty pin handling
if kill { if kill {
// Prevent misleading kill messages / statistics:
//
// Double check if client didn't stop already due to other
// reason and therefore doesn't reply to pin request.
//
// => give 1 second for client to terminate to prevent race
// between ctx.Cancel and terminating client.
ctx, _ := context.WithTimeout(context.Background(), 1*time.Second)
_, err := waitProcessEnd(ctx, wlink.client)
if err {
wlink.badPinKill(reason) // only fatal error wlink.badPinKill(reason) // only fatal error
} }
}
// NOTE unregistering watches and wlink itself is done on serve exit, not // NOTE unregistering watches and wlink itself is done on serve exit, not
// here, to avoid AB-BA deadlock on atMu and e.g. WatchLink.byfileMu . // here, to avoid AB-BA deadlock on atMu and e.g. WatchLink.byfileMu .
......
...@@ -480,7 +480,6 @@ def _bad_watch_killed_by_other(ctx, f, at): ...@@ -480,7 +480,6 @@ def _bad_watch_killed_by_other(ctx, f, at):
_bad_watch_suicide(ctx, f, at) _bad_watch_suicide(ctx, f, at)
f.assertKilled(ctx, "test didn't kill bad client") f.assertKilled(ctx, "test didn't kill bad client")
@mark.xfail
@mark.parametrize('faulty,dokill', [ @mark.parametrize('faulty,dokill', [
[_bad_watch_suicide, False], [_bad_watch_suicide, False],
[_bad_watch_killed_by_other, True], [_bad_watch_killed_by_other, True],
...@@ -539,7 +538,6 @@ def _bad_pin_killed_by_other(ctx, f, at): ...@@ -539,7 +538,6 @@ def _bad_pin_killed_by_other(ctx, f, at):
_bad_pin_suicide(ctx, f, at) _bad_pin_suicide(ctx, f, at)
f.assertKilled(ctx, "test did not kill") f.assertKilled(ctx, "test did not kill")
@mark.xfail
@mark.parametrize('faulty,dokill', [ @mark.parametrize('faulty,dokill', [
[_bad_pin_suicide, False], [_bad_pin_suicide, False],
[_bad_pin_killed_by_other, True], [_bad_pin_killed_by_other, True],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment