RFR: 8359477: com/sun/net/httpserver/Test12.java appears to have a temp file race [v4]

Daniel Fuchs dfuchs at openjdk.org
Tue Jul 1 14:23:48 UTC 2025


On Tue, 1 Jul 2025 11:21:53 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> test/jdk/com/sun/net/httpserver/Test12.java line 66:
>> 
>>> 64:         Path smallFilePath = createTempFileOfSize(TEMP_FILE_PREFIX, null, 23);
>>> 65:         Path largeFilePath = createTempFileOfSize(TEMP_FILE_PREFIX, null, 2730088);
>>> 66:         try (final ExecutorService executor = Executors.newCachedThreadPool()) {
>> 
>> I would not use try-with-resources here: I don't think we should close the executor before closing the servers.
>
> I've updated the PR to close the Executor after the servers have been closed. I'm guessing the suggestion was mostly as a precaution than what this test currently does?

Yes. stopping the server first ensures that the dispatcher's thread has exited, so there should be nothing submitting tasks to the executor past this point.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25820#discussion_r2177738506


More information about the net-dev mailing list