Skip to content

Approach Java 25 compatibility by stages#435

Draft
jeff5 wants to merge 3 commits into
jython:masterfrom
jeff5:java25-in-stages
Draft

Approach Java 25 compatibility by stages#435
jeff5 wants to merge 3 commits into
jython:masterfrom
jeff5:java25-in-stages

Conversation

@jeff5

@jeff5 jeff5 commented Jun 15, 2026

Copy link
Copy Markdown
Member

The objective is to break #424 into sections with a purpose. I have already dealt with JAR updates in #431 and #432, and we have a way of testing against Java 17 and 25 in the CI that currently fails (of course) but may be run on demand.

The first stage is the changes affecting tests that improve stability and allow them to run in an environment where Internet access is via a proxy.

These changes improve stability of network tests, especially the impact of tear-down, and our ability to run network tests behind an HTTP proxy. These changes are cherry-picked from PR 424 whose author we credit as author here.

We update lib-python/2.7/test/test_urllib2net.py from CPython 2.7.18 because the modified Lib/test/test_urllib2net.py is based on that.
@@ -1,5 +1,3 @@
#!/usr/bin/env python

import unittest

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we were not allowed to modify files under lib-python?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have simply copied it from CPython 2.7.18. That we allow ourselves, and would do more if it didn't break so much. Since the shadowing file is based on that, it seemed a helpful thing to have as comparator.

Since there is a shadowing file, it will have no effect, except as a sort of documentation.

@jeff5

jeff5 commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

The "Java versions regrtest 2.7" action runs the usual regression test on Java 17 and 25, on Ubuntu and Windows. With the stability and proxy change in place, the baseline results are:
17, Ubuntu:

     [exec] 4 fails unexpected:
     [exec]     test_httplib test_os test_posix test_socket

17, Windows:

     [exec] 1 fail unexpected:
     [exec]     test_httplib

25, Ubuntu:

     [exec] 11 fails unexpected:
     [exec]     test_cmd_line test_float_jy test_httplib test_java_integration
     [exec]     test_json test_jy_internals test_os test_posix test_socket
     [exec]     test_subprocess test_threading

25, Windows:

     [exec] 8 fails unexpected:
     [exec]     test_cmd_line test_float_jy test_httplib test_java_integration
     [exec]     test_json test_jy_internals test_subprocess test_threading

This is the baseline against which to measure progress adding the changes specific to Java 25 from #424.

robertpatrick and others added 2 commits June 16, 2026 17:37
This change is cherry-picked from PR 424.

We'll regenerate the Windows laucher (compiled from jython.py)
in a second step.
This was created from jython.py with PyInstaller.
@jeff5

jeff5 commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

Here I've taken just the improvements to the jython launcher script (used on Unix-like systems) and the jython.py launcher from #424, then regenerated the jython.exe launcher by steps described here but which we should add to the process docs. This ought to close #426, probably after compatible changes to the launcher test.

Some of the changes in #424 seem to be compensating the absence of this windows launcher in compiled form, or or any launcher (e.g. in the Ant script), providing options that the launcher(s) will supply. So let's see what additional passes we get just by fixing the launchers.

@jeff5

jeff5 commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

That's a lot better. New results are:
17, Ubuntu:

     [exec] 1 fail unexpected:
     [exec]     test_socket

17, Windows: passes
25, Ubuntu:

     [exec] 4 fails unexpected:
     [exec]     test_float_jy test_java_integration test_jy_internals test_socket

25, Windows:

     [exec] 3 fails unexpected:
     [exec]     test_float_jy test_java_integration test_jy_internals

The test_socket failures are all [Errno 98] Address already in use, which is often flakiness in tear-down of a test.

Comment thread src/shell/jython.py
return [self.java_mem, self.java_stack]

@property
def java_major_version(self):

@Stewori Stewori Jun 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #426 (comment)
Parsing output of java -version is not reliable, there are better ways.
Parsing output of java -XshowSettings:properties is recommended if a java call is deemed acceptible at all. Perhaps cleaner, cheaper, more lightweight is to read java_home/release. calling java could be a fallback if that file does not exist.

@robertpatrick

Copy link
Copy Markdown

The test_socket failures are all [Errno 98] Address already in use, which is often flakiness in tear-down of a test.

This is what I was trying to fix in the tests. In many of these tests, the previous test is relying on garbage collection rather than explicit cleanup of sockets listening on a port. That creates a race condition when a subsequent test tries to bind to the same port, making the tests flaky...

@jeff5

jeff5 commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

The test_socket failures are all [Errno 98] Address already in use, which is often flakiness in tear-down of a test.

This is what I was trying to fix in the tests. In many of these tests, the previous test is relying on garbage collection rather than explicit cleanup of sockets listening on a port. That creates a race condition when a subsequent test tries to bind to the same port, making the tests flaky...

I was disappointed too. I thought I had incorporated all such changes into the first commit on this branch, but have I missed something?

@robertpatrick

robertpatrick commented Jun 20, 2026

Copy link
Copy Markdown

Some of the changes in #424 seem to be compensating the absence of this windows launcher in compiled form

No. Not everyone uses (or can use) this compiled Windows launcher; for example, WLST doesn't. We can get by without this compiled Windows launcher. I filed the issue simply for completeness.

@robertpatrick

Copy link
Copy Markdown

I was disappointed too. I thought I had incorporated all such changes into the first commit on this branch, but have I missed something?

If you look back at the comments on #424, you will see that I said that I tried to fix the race conditions I ran into but that there are likely others. It is not easy to find race conditions without running into them.

@jeff5

jeff5 commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

On further thought, I think the re-run of test_socket is misleading. Sure test_socket fails, and fails to close a socket I expect, but when regrtest runs that suite again verbose, they all fail for that reason. The original cause is buried. I need to run the failing suites verbose on a fresh machine.

@jeff5

jeff5 commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

Some of the changes in #424 seem to be compensating the absence of this windows launcher in compiled form

No. Not everyone uses (or can use) this compiled Windows launcher; for example, WLST doesn't. We can get by without this compiled Windows launcher. I filed the issue simply for completeness.

By "some of them" I mean where a test does use the launcher, including in build.xml, we don't need to add those arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants