Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jdk_foreign_1_FAILED java/foreign/StdLibTest.java IllegalArgumentException: Unsupported charset: windows-1252 #20337

Closed
JasonFengJ9 opened this issue Oct 11, 2024 · 8 comments · Fixed by ibmruntimes/openj9-openjdk-jdk23#57

Comments

@JasonFengJ9
Copy link
Member

JasonFengJ9 commented Oct 11, 2024

Failure link

From internal Test_openjdk23_j9_sanity.openjdk_x86-64_windows_testList_6 (win10x86-rtp-rt5-1)

openjdk version "23" 2024-09-17
IBM Semeru Runtime Open Edition 23.0.1.0-m1 (build 23+37)
Eclipse OpenJ9 VM 23.0.1.0-m1 (build v0.48.0-release-8899b66789, JRE 23 Windows 10 amd64-64-Bit Compressed References 20240917_1 (JIT enabled, AOT enabled)
OpenJ9   - 8899b66789
OMR      - f8f0d789a
JCL      - bad8ef27634 based on jdk-23+37)

Rerun in Grinder - Change TARGET to run only the failed test targets

Optional info

Failure output (captured from console output)

[2024-10-10T02:40:29.755Z] variation: Mode650
[2024-10-10T02:40:32.352Z] JVM_OPTIONS:  -XX:-UseCompressedOops -Xverbosegclog 

[2024-10-10T02:46:19.963Z] TEST: java/foreign/StdLibTest.java

[2024-10-10T02:46:19.966Z] STDOUT:
[2024-10-10T02:46:19.966Z] NativeTestHelper::DEFAULT_RANDOM.seed = -1056041501
[2024-10-10T02:46:19.967Z] Re-run with '-DNativeTestHelper.DEFAULT_RANDOM.seed=-1056041501' to reproduce
[2024-10-10T02:46:19.967Z] test StdLibTest.testSystemLibraryBadLookupName(): success
[2024-10-10T02:46:19.967Z] test StdLibTest.test_printf([LONG, STRING, STRING, STRING]): failure
[2024-10-10T02:46:19.967Z] java.lang.IllegalArgumentException: Unsupported charset: windows-1252
[2024-10-10T02:46:19.967Z] 	at java.base/jdk.internal.foreign.StringSupport$CharsetKind.of(StringSupport.java:304)
[2024-10-10T02:46:19.967Z] 	at java.base/java.lang.foreign.SegmentAllocator.allocateFrom(SegmentAllocator.java:138)
[2024-10-10T02:46:19.967Z] 	at StdLibTest$StdLibHelper.printf(StdLibTest.java:318)
[2024-10-10T02:46:19.967Z] 	at StdLibTest.test_printf(StdLibTest.java:143)

[2024-10-10T02:46:19.994Z] TEST RESULT: Failed. Execution failed: `main' threw exception: java.lang.Exception: failures: 34100
[2024-10-10T02:46:19.994Z] --------------------------------------------------
[2024-10-10T03:24:59.811Z] Test results: passed: 91; failed: 1
[2024-10-10T03:27:15.912Z] Report written to C:\Users\jenkins\workspace\Test_openjdk23_j9_sanity.openjdk_x86-64_windows_testList_6\aqa-tests\TKG\output_1728524697271\jdk_foreign_1\report\html\report.html
[2024-10-10T03:27:15.912Z] Results written to C:\Users\jenkins\workspace\Test_openjdk23_j9_sanity.openjdk_x86-64_windows_testList_6\aqa-tests\TKG\output_1728524697271\jdk_foreign_1\work
[2024-10-10T03:27:15.912Z] Error: Some tests failed or other problems occurred.
[2024-10-10T03:27:17.275Z] -----------------------------------
[2024-10-10T03:27:17.275Z] jdk_foreign_1_FAILED

50x internal Grinder - all failed

Copy link

Issue Number: 20337
Status: Open
Recommended Components: comp:test, comp:vm, comp:jclextensions
Recommended Assignees: jasonfengj9, pshipton, longyuzhang

@r30shah
Copy link
Contributor

r30shah commented Oct 12, 2024

This must be due to my change in ibmruntimes/openj9-openjdk-jdk23#52 which gets the native encoded string before calling native printf through downcall.

I will take a look at this on Tuesday.

@r30shah
Copy link
Contributor

r30shah commented Oct 15, 2024

Looking at the JDK23 failing stack, it fails in [1], and I do not see support for any charset other than UTF , ISO-8859. I need go through the code to see how to fix this properly (I believe, on windows, having standard UTF-8 charset should be fine, but given that we pass in native charset on windows, it fails.

@JasonFengJ9 / @pshipton is this going to block 0.48 ? If yes, I can go ahead and revert the changes to ensure it works fine and work on more concrete fix.

Similar change went in JDK21 but it is OK there as we simply get the bytes in native encoding from given string and allocate segment using that, so we would not hit the issue.

FYI, @keithc-ca

[1]. https://github.com/ibmruntimes/openj9-openjdk-jdk23/blob/fe73bf0e7b4616ff17847da7a6c29acdb3df8b72/src/java.base/share/classes/jdk/internal/foreign/StringSupport.java#L289-L306

@keithc-ca
Copy link
Contributor

The test will need to be updated; SegmentAllocator.allocateFrom(String, Charset) says

 * throws IllegalArgumentException if charset is not a standard charset

@r30shah
Copy link
Contributor

r30shah commented Oct 15, 2024

Yes, this was my first instinct. If native charset is not standard, it should go on and allocate using default charset (Which is UTF-8), this would resolve current failure. And update the code for z/OS later.

@JasonFengJ9
Copy link
Member Author

is this going to block 0.48 ? If yes, I can go ahead and revert the changes to ensure it works fine and work on more concrete fix.

This is a test issue, it won't block 0.48.

r30shah added a commit to r30shah/openj9-openjdk-jdk23 that referenced this issue Oct 16, 2024
If native encoding charset is not one of the standard charset, allocate segment
using default charset for printf down call in StdLibTest.

Fixes: eclipse-openj9/openj9#20337

Signed-off-by: Rahil Shah <[email protected]>
r30shah added a commit to r30shah/openj9-openjdk-jdk23 that referenced this issue Oct 16, 2024
If native encoding charset is not one of the standard charset, allocate segment
using default charset for printf down call in StdLibTest.

Fixes: eclipse-openj9/openj9#20337

Signed-off-by: Rahil Shah <[email protected]>
r30shah added a commit to r30shah/openj9-openjdk-jdk23 that referenced this issue Oct 16, 2024
If native encoding charset is not one of the standard charset, allocate segment
using default charset for printf down call in StdLibTest.

Fixes: eclipse-openj9/openj9#20337

Signed-off-by: Rahil Shah <[email protected]>
r30shah added a commit to r30shah/openj9-openjdk-jdk23 that referenced this issue Oct 17, 2024
If native encoding charset is not one of the standard charset, allocate
segment using default charset for printf down call in StdLibTest.

Fixes: eclipse-openj9/openj9#20337

Signed-off-by: Rahil Shah <[email protected]>
r30shah added a commit to r30shah/openj9-openjdk-jdk23 that referenced this issue Oct 17, 2024
If native encoding charset is not one of the standard charset, allocate
segment using native encoded bytes for the string for printf down call
in StdLibTest.

Fixes: eclipse-openj9/openj9#20337

Signed-off-by: Rahil Shah <[email protected]>
Copy link

Issue Number: 20337
Status: Closed
Actual Components: comp:test, test failure
Actual Assignees: No one :(
PR Assignees: r30shah

1 similar comment
Copy link

Issue Number: 20337
Status: Closed
Actual Components: comp:test, test failure
Actual Assignees: No one :(
PR Assignees: r30shah

pshipton pushed a commit to pshipton/openj9-openjdk-jdk23 that referenced this issue Oct 18, 2024
Allocate segment using native encoded bytes for the string for printf
down call in StdLibTest.

Fixes: eclipse-openj9/openj9#20337

Signed-off-by: Rahil Shah <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants