RFR: 8004317 TestLibrary.getUnusedRandomPort() fails intermittently, but exception not reported

Jim Gish jim.gish at oracle.com
Wed Dec 5 16:41:17 UTC 2012


Thanks for the suggestions, Stuart.  BTW printStackTrace() prints to 
standard error by default -- that's why I don't explicitly have it in there.

Cheers,
    Jim

On 12/04/2012 07:06 PM, Stuart Marks wrote:
> Hi Jim,
>
> (Looks like you're cleaning up warnings along the way. I guess that's 
> OK.)
>
> Before printing the stack trace, there should be a message to stderr 
> indicating where this stack trace is coming from. For example, 
> "getUnusedRandomPort: caught exception". The stack trace should be 
> printed to stderr as well, using something like 
> ex.printStackTrace(System.err).
>
> I think narrowing the catch to IOException is good, since that's the 
> only exception case we really want to retry. I don't think it makes 
> sense to mention IllegalArgumentException or SecurityException 
> specifically in the comments though. Any exception other than 
> IOException should fail-fast.
>
> A message should also be printed if we decide to retry because the 
> port is one of the "reserved" ports. This might provide an important 
> clue to solving the puzzle.
>
> (My hypothesis is that this routine fails relatively silently when, on 
> its last retry, it successfully opens a reserved port. In this case ex 
> will be null and we get the RuntimeException with no further 
> explanation.)
>
> It would also be helpful to print numTries each time around the loop 
> so that we can see if it really is retrying that many times.
>
> Regarding netstat, I think it's a good idea, but I'd suggest we work 
> on it separately from this change. Instead, suppose we add a shell 
> script test that's named so that it runs at the end of the jdk_rmi 
> test target. This could just run netstat -a (or whatever) 
> unconditionally. In fact, I could do that without even pushing any 
> changes to the source code....
>
> s'marks
>
> On 12/4/12 1:42 PM, Jim Gish wrote:
>> OK -- how about a push then for now and with luck we might get some 
>> useful
>> output in a day or two.
>>
>> Jim
>>
>> On 12/04/2012 04:22 PM, Alan Bateman wrote:
>>> On 04/12/2012 21:10, Jim Gish wrote:
>>>> :
>>>>
>>>> P.S. working on adding nestat -a output per Alan's suggestion.
>>> BTW: I didn't mean you have to run with my comment, it's just that I 
>>> assume
>>> the issue that the Windows is out of dynamic ports. There is a registry
>>> setting to change the range, and I think there is a netsh command to 
>>> adjust
>>> it too. If we can somehow capture the netstat output then it may 
>>> confirm this.
>>>
>>> -Alan.
>>

-- 
Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304
Oracle Java Platform Group | Core Libraries Team
35 Network Drive
Burlington, MA 01803
jim.gish at oracle.com




More information about the core-libs-dev mailing list