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

Stuart Marks stuart.marks at oracle.com
Thu Dec 6 05:24:47 UTC 2012


Pushed:

http://hg.openjdk.java.net/jdk8/tl/jdk/rev/a971516029ab

I couldn't resist doing a couple more fixups. (Man, there is a lot more 
cleaning up that could be done in here.)

I don't know if I got this in time for tonight's nightly. Well, get it in there 
and see if it falls over sooner or later.

s'marks

On 12/5/12 4:02 PM, Jim Gish wrote:
> Thanks Stuart.  Sure - go ahead and make the change and do the push. Maybe
> we'll get lucky with the nightlies!
>
> Thanks again,
>     Jim
> On 12/05/2012 06:54 PM, Stuart Marks wrote:
>> OK, looks better, more explicit so that we can find out why this is failing.
>>
>> There's still a subtle issue in the reporting though. Consider if on attempt
>> N the ServerSocket call gets a valid port but it's one of the reserved ports.
>> Then, unusedRandomPort will be >= 0 and isReservedPort() will be true, so
>> we'll get the "INFO" message.
>>
>> Now on attempt N+1 suppose ServerSocket throws an exception. We'll get the
>> exception stack trace, but then unusedRandomPort will still have its previous
>> value, and we'll get the INFO message again, but spuriously this time. I hate
>> to ask you to update this again, but as it stands I think the output will be
>> quite confusing.
>>
>> I think setting unusedRandomPort back to -1 at the top of the loop should fix
>> it.
>>
>> You need me to push this for you? I can drop in this change before I push, if
>> you're OK with me doing this.
>>
>> s'marks
>>
>> On 12/5/12 12:51 PM, Jim Gish wrote:
>>> Here's a new version for your consideration :-)
>>>
>>> http://cr.openjdk.java.net/~jgish/Bug8004317-TestLibrary-getUnusedRandomPort-Failure/
>>>
>>> <http://cr.openjdk.java.net/%7Ejgish/Bug8004317-TestLibrary-getUnusedRandomPort-Failure/>
>>>
>>>
>>> Thanks,
>>>     Jim
>>>
>>> On 12/05/2012 02:45 PM, Stuart Marks wrote:
>>>> On 12/5/12 8:41 AM, Jim Gish wrote:
>>>>> BTW printStackTrace() prints to standard error by default -- that's why I
>>>>> don't
>>>>> explicitly have it in there.
>>>>
>>>> Oh yes, so it does. Sorry, I was confused.
>>>>
>>>> s'marks
>>>
>>> --
>>> 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