-
Notifications
You must be signed in to change notification settings - Fork 2.3k
JERSEY-2291: Enable HK2 Immediate scope to support HK2 @Immediate services. #173
Conversation
|
Can one of the admins verify this patch? |
|
Hi Jord, More information about contributing to Jersey: https://jersey.java.net/scm.html#/Submitting_Patches_and_Contribute_Code Thanks, |
|
Jenkins, please test this patch. |
|
Thanks, I just submitted my OCA today. |
|
Hi Jord, In order to accept your patch, it needs to come up with at least one test that verifies the enhancement works as expected (your case) or that contains a reproducer for the fixed bug (in case of a bug fix patch). Cheers, |
b2cb5e5 to
317cee1
Compare
|
I have added a test case which verifies the added functionality. Please take another look. |
|
I think the test failure from before may have been spurious. I just synced my local fork with master and re-ran the failed test and it passed. Please take another look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing copyright header. Please use a header e.g. from here: https://github.com/jersey/jersey/blob/master/core-common/src/test/java/org/glassfish/jersey/process/internal/ExecutorProvidersTest.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
Overall looks good. Please, fix 2 minor issues and we'll merge this pull request. |
|
I have addressed all review comments. Please take another look. |
|
Jenkins, test this patch. |
|
There is one failing test - seems it's caused by your change (verified on my machine). I'll take a look at it tomorrow. |
|
I am unable to fail that test. I've synced up to jersey head and am doing On Wed, Jun 24, 2015 at 11:41 AM, Michal Gajdos notifications@github.com
|
|
causes that |
|
The problem is in the test itself. |
|
Hi jordmoz, sorry for the delay. Thanks, |
|
Yeah, it seemed like an easy fix :) Writing the test was fun; I didn't know HK2 used a separate thread for the Immediate scoped object instantiations, so my tests kept failing. Wow, 5000 seems high. Right now it's ... 500? And I think it fails saying it was at 1000. (If memory serves.) So we're increasing it 10x ... I'm fine with this if you are, but perhaps a lower limit would also be acceptable? I haven't touched this in a while, so maybe the limit is different now. I'll work on this again and fix it. [Update: I misunderstood the difference between iterations and the limit. 5000 is fine. Above test code references 4000 though and that's what I ended up using.] |
|
I took the above test code from @mgajdos and the test now passes. I also rebased everything to current jersey master. |
|
Hi jordmoz, right now it was 1000, not sure what the number was when Michal suggested 4000. I'll retrigger the verification build and we will see. The thing is, of course for testing it would be great to have lower number of iterations, but for "some" reason (the reason being, that the test is not really deterministic), it kept failing when I tried the same change as you are suggesting locally. At least on my JVM/configuration/environment, seems like the lower amount of iterations did not "force" the GC to work. Of course the solution is not systematic, is just to make it work and not force you to fix test not related to your patch. Regards, |
|
Jenkins, please test this patch. |
|
Test still fails :( |
|
It does pass locally with which was failing before. |
|
I see. The test needs to be changed. The patch definitely influences the test pass rate, but apparently, as it does not fail everytime (and sometime it fails with the number of instances higher than the treshold, but lower than the number of iterations), I guess we can assume that it does not cause a new leak. For now, I'll just try to re-run the build, in the meantime I'll try to think of what to do with the test. Cheers, |
|
Jenkins, please re-test this patch. |
|
Jenkins, please re-test this patch. |
|
Frustrating. :( |
|
Indeed. The test is not really deterministic, however I didn't find with any better idea how to test the change it tests. Just spent some time experimenting with it and came up with one more desperate try, counting instances not enqueued to the reference queue and/or references, that still point to a live object. This reduces the total number, at least on my environment. Hard to predict, how it will behave on Jenkins though. Could you please try to change the assert to the following code: I hope that this will make the test more stable, but without trying it on Jenkins, we will never know... Regards, |
Add copyright header. Reformat to use 4 space indents.
|
I rebased onto jersey master and put in your patch. Please try jenkins again. |
|
Hrm I seem to be missing a client.close(), which is present in the master version. Is that not needed? I think a previous patch may have taken it out. The test does pass for me when running: mvn clean install -pl core-client -am |
|
Jenkins, please test this patch. |
|
Thanks. Well, I guess the test is not necessary, but I would think it will be merged anyway. I hope this time the test passes also on Jenkins, the previous version did pass on my environment as well, but the VM on Jenkins seems to be more lazy about GCing. Adam |
|
Wow, nice! :-) |
JERSEY-2291: Enable HK2 Immediate scope to support HK2 @Immediate services.
|
Thanks for the contribution and sorry for hassle with the failing test. Cheers, |
|
Crazy. Thanks for all your help! |
Change-Id: I8c7d298816ebe51dc9f76450ae2f32096f91a999
|
Hi, I'm sorry but we have to revert your change. The reason is that HK2 does not work as expected and a memory leak can occur under certain circumstances. Tracked here https://java.net/jira/browse/HK2-280. |
|
Argh. Thanks for the update. |
|
Now, when https://java.net/jira/browse/HK2-280 is solved. It might be possible to make it work. If anyone is interested, don't hesitate to get into it. I gave it a quick shoot but without success (https://java.net/jira/browse/JERSEY-2291?focusedCommentId=390642&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-390642 ) |
https://java.net/jira/browse/JERSEY-2291
Hopefully addresses the above issue.