-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Test config creation sometimes delegates to instance variable and sometimes to superclass, causing (v v minor) chaos #45652
Test config creation sometimes delegates to instance variable and sometimes to superclass, causing (v v minor) chaos #45652
Conversation
Thanks for your pull request! Your pull request does not follow our editorial rules. Could you have a look?
This message is automatically generated by a bot. |
This comment has been minimized.
This comment has been minimized.
64a1cc4
to
c1c3bdf
Compare
Status for workflow
|
Let's backport to 3.18. And yes I would be in favor of having an interface and a delegation model. |
Yes, the problem here is that I needed specific methods from I'll improve it. |
I agree we should backport, since the change is (a) obviously correct and (b) low-risk. But I also think this is a very latent defect; as far as I know, we weren't seeing any symptoms until I started pushing the test classloading down new paths. Probably the next time the current design would cause problems is if a new method gets added to the superclass and we don't remember to update the subclass. That's a risk, but not an immediate one. Improvement would be good, but I'd say it's definitely not the highest priority. |
I just spent a while wondering if I was losing my mind, until the debugger helped me out.
I was staring at code in the
TestConfigProviderResolver
that did this:... and it was failing because the config hadn't been released. "How can it not be released? I can see the release call one line above the failing call, and there's no concurrency here!" I wailed.
Working through the problem in a debugger, I realised that the release and register call were being applied to different objects. At this point, I was hollering at the computer "What? how they be different objects? They're the same object, I can see it right there!"
The wrinkle in this case, is that TestConfigProviderResolver both extends from another resolver, and holds an instance of it as an instance variable. The superclass and instance variable are not at all guaranteed to be the same object. In this case, one method was going to the superclass, and one was going to the instance variable. I could only spot that by staring at screencaps of the debugger on the release and register calls.
It would be nice if
TestConfigProviderResolver
could implement an interface instead, since that avoids this kind of risk, but I assume that's not possible.