On Fri, Feb 01, 2013 at 12:26:27PM -0500, Jesse Glick wrote: > On 02/01/2013 06:21 AM, Julian Schmidt wrote: > >>do you know how to reproduce this? A fix this important deserves a > >>regression test. > > > >I though I did that > > Reproduced manually, or added a test? #688 [1] has no test changes. If I can > get some time to work on this pull request I will see if I can reproduce in a > test.
I meant I did create a github pull request. > > >it is triggered by garbage-collection, which does not seem to be 100% > >deterministic > > Indeed it is not. If the bug is caused reliably when garbage > collection happens, then writing a test is not hard: just call > System.gc(). That is not _guaranteed_ to collect everything, which > is why it is sometimes necessary to use tricks [2] to force > collection, especially if the test will fail unless something is > collected. In this case it is more likely that an incomplete > collection would just make the test not fail reliably enough with > the fix not applied, which is tolerable if the developer is willing > to run the test a few times with and without the proposed fix. > > (If the bug is caused when GC does _not_ happen then it is trickier > to write a test, though sometimes still possible, by explicitly > holding a strong reference to a certain object from test code.) > > What would be useful is a MockWeakReference<T> extends Reference<T>, > with an injectable ReferenceFactory<T> used by Jenkins code (default > impl creating WeakReference<T>), so that a test could > deterministically “collect” specific references at specific times. Thanks to your input I was able to write a test which reproduces this bug. I added it to the pull request (I took the liberty to rewrite the commits in that request). -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
