From c59a51a0651bbe8d29c81e00900df9aade471a71 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 10 Aug 2020 16:18:47 -0400 Subject: [PATCH] discard any exception thrown while trying to kill worker threads Since there's a race here, and since Kyle saw an exception leak out, which I have not been able to reproduce that. See my comment for what I think might be going on. Note that, I used tryNonAsync, because it seems a later tryNonAsync caught the exception. I don't actually understand how it did, as I understand exception classification, it's the data type, not the way it was thrown. One possibility is that the async exception may have been wrapped in some other, non-async exception, and Show displayed it the same way. --- Utility/Metered.hs | 2 +- ..._15_93e2dd2b30cdeddd5e273eae78a422e0._comment | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 doc/bugs/Recent_hang_with_rsync_remote_with_older_systems___40__Xenial__44___Jessie__41__/comment_15_93e2dd2b30cdeddd5e273eae78a422e0._comment diff --git a/Utility/Metered.hs b/Utility/Metered.hs index ad920c3528..3a9d3620a7 100644 --- a/Utility/Metered.hs +++ b/Utility/Metered.hs @@ -328,7 +328,7 @@ outputFilter cmd params environ outfilter errfilter = -- maximum for them to finish and then cancel them. -- (One program that has behaved this way in the past is -- openssh.) - race_ + void $ tryNonAsync $ race_ (wait outt >> wait errt) (threadDelaySeconds (Seconds 2) >> cancel outt >> cancel errt) return ret diff --git a/doc/bugs/Recent_hang_with_rsync_remote_with_older_systems___40__Xenial__44___Jessie__41__/comment_15_93e2dd2b30cdeddd5e273eae78a422e0._comment b/doc/bugs/Recent_hang_with_rsync_remote_with_older_systems___40__Xenial__44___Jessie__41__/comment_15_93e2dd2b30cdeddd5e273eae78a422e0._comment new file mode 100644 index 0000000000..5155449d73 --- /dev/null +++ b/doc/bugs/Recent_hang_with_rsync_remote_with_older_systems___40__Xenial__44___Jessie__41__/comment_15_93e2dd2b30cdeddd5e273eae78a422e0._comment @@ -0,0 +1,16 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 15""" + date="2020-08-10T20:06:28Z" + content=""" +Hmm, come to think of it, `wait errt` is racing +`cancel errt`, so what if cancel kills the errt thread, +and before `race` noticed cancel is done, the wait thread +sees errt, died of an an AsyncCancelled exception and rethrows that? +Result could be the exception leaking out, perhaps. + +It might be that async now avoids that, and some other version didn't, or +you could be getting unlucky with the race. + +So, I've added something to catch that exception in case it leaks. +"""]] -- 2.30.2