-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Common Test hooks mishandle exit signals with link #7119
Comments
Apart from above, loosing Config in case of test process crash does not surprise me that much in this scenario ... I don't think this is a bug at this stage. |
ping @jcpetruzza |
Thanks for looking into this, @u3s and sorry for the very late reply, I just returned from some holidays :)
I agree that I shouldn't have used Anyway, after correcting that, we see that
I disagree. Consider this concrete example:
We can see how CT is behaving differently (at least in R25) by looking at the log output: A "good" case:
A "bad" case:
Why I think the latter is a bug:
Regarding your other comments:
We do leverage the CTHState to be able to workaround the issue. We are using it as a lookup-table to see if there is a "more recent" Config we should use. It is tricky since it can lead to space-leaks and introduces a lot of unnecessary complexity, since CT's responsibility is to handle the Config lifetime correctly
Not when the hook is managing individual resources for each testcase; need to account for parallel execution; the same testcase can occur in multiple groups, etc. The Config is the only reliable source of truth in that case, afaics.
Well, iiuc, that's precisely what we are trying to do, and why "the bad" case is problematic: the |
thanks for re-phrasing and updating the description. I now agree with your observation. when looking at pids:
this looks strange. I will need to check source code to figure out the root cause of this behavior. |
#7246 fix is merged to maint branch |
I have a Common Test hook that looks something like this:
Consider these possible testcases:
I observe 3 possible behaviours of CT with respect the hook above (using otp-25), depending on the testcase:
test_ok
ortest_normal_failure
we get:-
pre_end_per_testcase/4
is called, then-
end_per_testcase/2
is called, and finally-
post_end_per_testcase/5
is called, withConfig
bound to the return value ofpre_end_per_testcase/4
.test_timetrap
ortest_exit_signal
we get:-
pre_end_per_testcase/4
is not called,-
end_per_testcase/2
is not called, and-
post_end_per_testcase/4
is called, withConfig
bound to the same value the testcase receivedtest_exit_signal_with_link
we get:pre_end_per_testcase/4
is called, thenend_per_testcase/2
is called, and finallypost_end_per_testcase/5
is called, but withConfig
bound to the same value the testcase received!As hook author, case 2 is a bit ugly, since one needs to account for the fact that sometimes
pre_end_per_testcase
may not get called, but the problematic one is case 3:Config
passed topost_end_per_testcase/5
is not whatpre_end_per_testcase/4
returned sounds like a bug? In the hook above, it means that there is aHandle
that would not get closed. It is possible to work around this, I think, but it is not nice.The text was updated successfully, but these errors were encountered: