Repository navigation
Approach Java 25 compatibility by stages - #435
Conversation
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.
|
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, Windows: 25, Ubuntu: 25, Windows: This is the baseline against which to measure progress adding the changes specific to Java 25 from #424. |
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.
|
Here I've taken just the improvements to the 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. |
|
That's a lot better. New results are: 17, Windows: passes 25, Windows: The |
| return [self.java_mem, self.java_stack] | ||
|
|
||
| @property | ||
| def java_major_version(self): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
The bit in quotes output by the standard option -version seems to be exactly java.version, output by the non-standard option -XshowSettings:properties. It's hard to favour the latter, and for now, I'd leave it.
There was a problem hiding this comment.
See my comment here: #426 (comment)
I acknowledged that -X is non-standard and should not be used. It's a pity that Java has no standard way of version detection. -version does not count because its output is unspecified. A de-facto standard, not a standard. It looks like the new intended standard way to do this is indeed the java_home/release file, so that way should be preferred.
If you don't want this tackled for 2.7.5, this is fine (although I offered to do it when I wrote that comment). But we should move to the standard way on this matter eventually.
There was a problem hiding this comment.
It's still open to you to give a better response to #426 than I have by compiling jython.py as Robert has provided it.
I thought the little class providing version in the optimum form was simplest and certain to find the same java executable we're about to use for Jython. (It could be in the Jython JAR, even if other code in there could not run with the same options.)
Something that requires JAVA_HOME to be right, doesn't sound as reliable, and running java to find property java.home begins to get circular.
There was a problem hiding this comment.
If we're all happy with the rest of this, I'll merge it.
There was a problem hiding this comment.
And then you go to MacOS where java is /usr/bin/java and the JAVA_HOME is in /Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home... :-)
Personally, I would throw an error if JAVA_HOME does not point to a valid Java installation...
There was a problem hiding this comment.
Okay, readlink -f $(which java). Does that work on MacOS, too?
There was a problem hiding this comment.
It "works" but I'm not sure it helps...
rpatrick@rpatrick-mac1 ~ % readlink -f $(which java)
/usr/bin/java
rpatrick@rpatrick-mac1 ~ %
There was a problem hiding this comment.
Windows
cmddoes not have something similar?
It's where (or where.exe). It isn't a shell built-in.
There was a problem hiding this comment.
Yes, Windows has a where command but it works differently than which. where returns all paths to the program in the PATH but which only returns the first entry in the path.
C:\Users\rpatrick>where java
c:\java\jdk1.8.0_491\bin\java.exe
c:\java\jdk-11.0.9\bin\java.exe
c:\java\jdk-17.0.16\bin\java.exe
c:\java\jdk-21.0.8\bin\java.exe
c:\java\jdk-25.0.4\bin\java.exe
C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
C:\Users\rpatrick>
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? |
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. |
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. |
|
On further thought, I think the re-run of |
By "some of them" I mean where a test does use the launcher, including in |
|
@jeff5 any ETA on getting all of the JDK 25 changes merged? My company needs a version of Jython supporting JDK 25 before the end of July. It seems unlikely to me that even a first alpha version of jython will be tagged and ready by that point. If not, that leaves us with only bad options... |
|
@robertpatrick It deserves a more credible estimate, it is true. Unfortunately, a few hard to ignore issues/PRs (not just yours) came in after that estimate. |
|
@jeff5 well...that is what professional software development is all about. I gave you a PR that completed the JDK25 support but you chose not to use it because it didn't meet some arbitrary metric. You claimed you would merge it in pieces but that was 6 weeks ago. I see little evidence that this will be merged in the next 5 weeks. My company will be forced to fork Jython in order to maintain our release schedules for JDK 25 support. I feel sorry that it came to this. |
This brings in an action for verbose tests on Linux.
|
Annoyingly, the focussed verbose tests didn't explain why No surprises in the others so I'll knock them off next with Robert's code. |
This change is cherry-picked from PR 424. We are able to add this having regenerated the Windows laucher (compiled from jython.py).
These adapt to Java 17 and 25 differences. We only need what the launchers themselves do not add. This change is cherry-picked from PR 424.
A long-standing Java bug has been fixed in Java 19. This change is cherry-picked from PR 424.
The currency symbol in the Chinese mainland locale has changed. We also bring in the Java 25 changes to build.gradle at this point, since it runs the Java tests. This change is cherry-picked from PR 424 with improvements.
|
The latest change, to address a change to the currency symbol in the Chinese mainland locale, includes an addition I made because our parsing of the major version number was failing. My fault if it is still wrong. (I wonder why we take this approach? But I've kept the change minimal.) At first the additional Updating Gradle is the right course but has always entailed a lot of painful change, so not right now thanks. |
|
I am getting good conformance now in tests I launch maually to run on Java 17 and 25. https://github.com/jeff5/jython/actions/runs/28709014459, although |
The change adds a test tearDown() to remove the proxy_handler. (Suspect the one in lib-python/2.7 to be erroneously modified.) This change is cherry-picked from PR 424.
|
The only things I think are left to include from #424 are the shadowing of I think the new I'm accepting the changes to |
This change is cherry-picked from PR 424.
|
I would probably merge this with a merge commit. Not a squash, since that defeats the objective of unpacking it so carefully. |
Ok, I see how this benefits us building on Java 8 and testing on other versions. (Without it, there is always a tiny amount of recompilation.) I'll add. |
Also NEWS updated. This change is cherry-picked from PR 424.
This merges a series of change sets, each addressing some aspect of Java 25 support in Jython. They were provided originally as one large change set in PR 424. We prefer this presentation because it makes the changes easier to understand for subsequent maintainers. Conflicts: build.gradle
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.