Skip to content

Commit c4444cb

Browse files
committed
Merge master jdk-17.0.13+3 into openj9-staging
Signed-off-by: J9 Build <[email protected]>
2 parents b5d1ec3 + 87a838b commit c4444cb

File tree

67 files changed

+2049
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2049
-218
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -344,26 +344,23 @@ jobs:
344344
- test-windows-x64
345345

346346
steps:
347-
# Hack to get hold of the api environment variables that are only defined for actions
348-
- name: 'Get API configuration'
349-
id: api
350-
uses: actions/github-script@v7
351-
with:
352-
script: 'return { url: process.env["ACTIONS_RUNTIME_URL"], token: process.env["ACTIONS_RUNTIME_TOKEN"] }'
353-
354347
- name: 'Remove bundle artifacts'
355348
run: |
356349
# Find and remove all bundle artifacts
357-
ALL_ARTIFACT_URLS="$(curl -s \
358-
-H 'Accept: application/json;api-version=6.0-preview' \
359-
-H 'Authorization: Bearer ${{ fromJson(steps.api.outputs.result).token }}' \
360-
'${{ fromJson(steps.api.outputs.result).url }}_apis/pipelines/workflows/${{ github.run_id }}/artifacts?api-version=6.0-preview')"
361-
BUNDLE_ARTIFACT_URLS="$(echo "$ALL_ARTIFACT_URLS" | jq -r -c '.value | map(select(.name|startswith("bundles-"))) | .[].url')"
362-
for url in $BUNDLE_ARTIFACT_URLS; do
363-
echo "Removing $url"
364-
curl -s \
365-
-H 'Accept: application/json;api-version=6.0-preview' \
366-
-H 'Authorization: Bearer ${{ fromJson(steps.api.outputs.result).token }}' \
367-
-X DELETE "$url" \
350+
# See: https://docs.github.com/en/rest/actions/artifacts?apiVersion=2022-11-28
351+
ALL_ARTIFACT_IDS="$(curl -sL \
352+
-H 'Accept: application/vnd.github+json' \
353+
-H 'Authorization: Bearer ${{ github.token }}' \
354+
-H 'X-GitHub-Api-Version: 2022-11-28' \
355+
'${{ github.api_url }}/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts')"
356+
BUNDLE_ARTIFACT_IDS="$(echo "$ALL_ARTIFACT_IDS" | jq -r -c '.artifacts | map(select(.name|startswith("bundles-"))) | .[].id')"
357+
for id in $BUNDLE_ARTIFACT_IDS; do
358+
echo "Removing $id"
359+
curl -sL \
360+
-X DELETE \
361+
-H 'Accept: application/vnd.github+json' \
362+
-H 'Authorization: Bearer ${{ github.token }}' \
363+
-H 'X-GitHub-Api-Version: 2022-11-28' \
364+
"${{ github.api_url }}/repos/${{ github.repository }}/actions/artifacts/$id" \
368365
|| echo "Failed to remove bundle"
369366
done

make/autoconf/configure.ac

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,11 @@ AC_OUTPUT
300300

301301
# After AC_OUTPUT, we need to do final work
302302
CUSTOM_CONFIG_OUTPUT_GENERATED_HOOK
303-
BASIC_POST_CONFIG_OUTPUT
304303

305304
# Finally output some useful information to the user
306305
HELP_PRINT_SUMMARY_AND_WARNINGS
307306
CUSTOM_SUMMARY_AND_WARNINGS_HOOK
308307
HELP_REPEAT_WARNINGS
308+
309+
# All output is done. Do the post-config output management.
310+
BASIC_POST_CONFIG_OUTPUT

src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
2727

2828
import java.io.*;
2929
import java.net.*;
30+
import java.util.Objects;
31+
3032
import com.sun.net.httpserver.*;
3133
import com.sun.net.httpserver.spi.*;
3234

@@ -77,6 +79,10 @@ public void write (int b) throws IOException {
7779
}
7880

7981
public void write (byte[]b, int off, int len) throws IOException {
82+
Objects.checkFromIndexSize(off, len, b.length);
83+
if (len == 0) {
84+
return;
85+
}
8086
if (closed) {
8187
throw new StreamClosedException ();
8288
}

src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -240,6 +240,7 @@ public void sendResponseHeaders (int rCode, long contentLen)
240240
}
241241
noContentToSend = true;
242242
contentLen = 0;
243+
o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen));
243244
} else { /* not a HEAD request or 304 response */
244245
if (contentLen == 0) {
245246
if (http10) {
@@ -282,9 +283,7 @@ public void sendResponseHeaders (int rCode, long contentLen)
282283
sentHeaders = true;
283284
logger.log(Level.TRACE, "Sent headers: noContentToSend=" + noContentToSend);
284285
if (noContentToSend) {
285-
WriteFinishedEvent e = new WriteFinishedEvent (this);
286-
server.addEvent (e);
287-
closed = true;
286+
close();
288287
}
289288
server.logReply (rCode, req.requestLine(), null);
290289
}

src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
2727

2828
import java.io.*;
2929
import java.net.*;
30+
import java.util.Objects;
31+
3032
import com.sun.net.httpserver.*;
3133
import com.sun.net.httpserver.spi.*;
3234

@@ -41,7 +43,6 @@
4143
class FixedLengthOutputStream extends FilterOutputStream
4244
{
4345
private long remaining;
44-
private boolean eof = false;
4546
private boolean closed = false;
4647
ExchangeImpl t;
4748

@@ -58,22 +59,21 @@ public void write (int b) throws IOException {
5859
if (closed) {
5960
throw new IOException ("stream closed");
6061
}
61-
eof = (remaining == 0);
62-
if (eof) {
62+
if (remaining == 0) {
6363
throw new StreamClosedException();
6464
}
6565
out.write(b);
6666
remaining --;
6767
}
6868

6969
public void write (byte[]b, int off, int len) throws IOException {
70+
Objects.checkFromIndexSize(off, len, b.length);
71+
if (len == 0) {
72+
return;
73+
}
7074
if (closed) {
7175
throw new IOException ("stream closed");
7276
}
73-
eof = (remaining == 0);
74-
if (eof) {
75-
throw new StreamClosedException();
76-
}
7777
if (len > remaining) {
7878
// stream is still open, caller can retry
7979
throw new IOException ("too many bytes to write to stream");
@@ -92,7 +92,6 @@ public void close () throws IOException {
9292
throw new IOException ("insufficient bytes written to stream");
9393
}
9494
flush();
95-
eof = true;
9695
LeftOverInputStream is = t.getOriginalInputStream();
9796
if (!is.isClosed()) {
9897
try {

src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,14 @@ public void run () {
696696
return;
697697
}
698698
String uriStr = requestLine.substring (start, space);
699-
URI uri = new URI (uriStr);
699+
URI uri;
700+
try {
701+
uri = new URI (uriStr);
702+
} catch (URISyntaxException e3) {
703+
reject(Code.HTTP_BAD_REQUEST,
704+
requestLine, "URISyntaxException thrown");
705+
return;
706+
}
700707
start = space+1;
701708
String version = requestLine.substring (start);
702709
Headers headers = req.headers();
@@ -732,7 +739,13 @@ public void run () {
732739
} else {
733740
headerValue = headers.getFirst("Content-Length");
734741
if (headerValue != null) {
735-
clen = Long.parseLong(headerValue);
742+
try {
743+
clen = Long.parseLong(headerValue);
744+
} catch (NumberFormatException e2) {
745+
reject(Code.HTTP_BAD_REQUEST,
746+
requestLine, "NumberFormatException thrown");
747+
return;
748+
}
736749
if (clen < 0) {
737750
reject(Code.HTTP_BAD_REQUEST, requestLine,
738751
"Illegal Content-Length value");
@@ -818,20 +831,11 @@ public void run () {
818831
uc.doFilter (new HttpExchangeImpl (tx));
819832
}
820833

821-
} catch (IOException e1) {
822-
logger.log (Level.TRACE, "ServerImpl.Exchange (1)", e1);
823-
closeConnection(connection);
824-
} catch (NumberFormatException e2) {
825-
logger.log (Level.TRACE, "ServerImpl.Exchange (2)", e2);
826-
reject (Code.HTTP_BAD_REQUEST,
827-
requestLine, "NumberFormatException thrown");
828-
} catch (URISyntaxException e3) {
829-
logger.log (Level.TRACE, "ServerImpl.Exchange (3)", e3);
830-
reject (Code.HTTP_BAD_REQUEST,
831-
requestLine, "URISyntaxException thrown");
832-
} catch (Exception e4) {
833-
logger.log (Level.TRACE, "ServerImpl.Exchange (4)", e4);
834-
closeConnection(connection);
834+
} catch (Exception e) {
835+
logger.log (Level.TRACE, "ServerImpl.Exchange", e);
836+
if (tx == null || !tx.writefinished) {
837+
closeConnection(connection);
838+
}
835839
} catch (Throwable t) {
836840
logger.log(Level.TRACE, "ServerImpl.Exchange (5)", t);
837841
throw t;
@@ -856,9 +860,8 @@ void reject (int code, String requestStr, String message) {
856860
rejected = true;
857861
logReply (code, requestStr, message);
858862
sendReply (
859-
code, false, "<h1>"+code+Code.msg(code)+"</h1>"+message
863+
code, true, "<h1>"+code+Code.msg(code)+"</h1>"+message
860864
);
861-
closeConnection(connection);
862865
}
863866

864867
void sendReply (

src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
2727

2828
import java.io.*;
2929
import java.net.*;
30+
import java.util.Objects;
31+
3032
import com.sun.net.httpserver.*;
3133
import com.sun.net.httpserver.spi.*;
3234

@@ -55,6 +57,10 @@ public void write (int b) throws IOException {
5557
}
5658

5759
public void write (byte[]b, int off, int len) throws IOException {
60+
Objects.checkFromIndexSize(off, len, b.length);
61+
if (len == 0) {
62+
return;
63+
}
5864
if (closed) {
5965
throw new IOException ("stream closed");
6066
}

test/hotspot/jtreg/compiler/codecache/CodeCacheFullCountTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,11 @@ public static void runTest() throws Throwable {
5757
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
5858
"-XX:ReservedCodeCacheSize=2496k", "-XX:-UseCodeCacheFlushing", "CodeCacheFullCountTest", "WasteCodeCache");
5959
OutputAnalyzer oa = ProcessTools.executeProcess(pb);
60-
oa.shouldHaveExitValue(0);
60+
// Ignore adapter creation failures
61+
if (oa.getExitValue() != 0 && !oa.getStderr().contains("Out of space in CodeCache for adapters")) {
62+
oa.reportDiagnosticSummary();
63+
throw new RuntimeException("VM finished with exit code " + oa.getExitValue());
64+
}
6165
String stdout = oa.getStdout();
6266

6367
Pattern pattern = Pattern.compile("full_count=(\\d)");

test/hotspot/jtreg/gc/g1/plab/lib/LogParser.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
*
3838
* Typical GC log with PLAB statistics (options - -Xlog:gc=debug,gc+plab=debug) looks like:
3939
*
40-
* [0.330s][debug][gc,plab ] GC(0) Young PLAB allocation: allocated: 1825632B, wasted: 29424B, unused: 2320B, used: 1793888B, undo waste: 0B,
41-
* [0.330s][debug][gc,plab ] GC(0) Young other allocation: region end waste: 0B, regions filled: 2, direct allocated: 271520B, failure used: 0B, failure wasted: 0B
42-
* [0.330s][debug][gc,plab ] GC(0) Young sizing: calculated: 358776B, actual: 358776B
43-
* [0.330s][debug][gc,plab ] GC(0) Old PLAB allocation: allocated: 427248B, wasted: 592B, unused: 368584B, used: 58072B, undo waste: 0B,
44-
* [0.330s][debug][gc,plab ] GC(0) Old other allocation: region end waste: 0B, regions filled: 1, direct allocated: 41704B, failure used: 0B, failure wasted: 0B
45-
* [0.330s][debug][gc,plab ] GC(0) Old sizing: calculated: 11608B, actual: 11608B
40+
* [0.192s][debug][gc,plab ] GC(0) Young PLAB allocation: allocated: 2867184B, wasted: 656B, unused: 252896B, used: 2613632B, undo waste: 0B,
41+
* [0.192s][debug][gc,plab ] GC(0) Young other allocation: region end waste: 0B, regions filled: 3, num plab filled: 30, direct allocated: 16400B, num direct allocated: 1, failure used: 0B, failure wasted: 0B
42+
* [0.192s][debug][gc,plab ] GC(0) Young sizing: calculated: 522720B, actual: 522720B
43+
* [0.192s][debug][gc,plab ] GC(0) Old PLAB allocation: allocated: 0B, wasted: 0B, unused: 0B, used: 0B, undo waste: 0B,
44+
* [0.192s][debug][gc,plab ] GC(0) Old other allocation: region end waste: 0B, regions filled: 0, num plab filled: 0, direct allocated: 0B, num direct allocated: 0, failure used: 0B, failure wasted: 0B
45+
* [0.192s][debug][gc,plab ] GC(0) Old sizing: calculated: 0B, actual: 2064B
4646
*/
4747
final public class LogParser {
4848

@@ -62,7 +62,8 @@ public static enum ReportType {
6262
// GC ID
6363
private static final Pattern GC_ID_PATTERN = Pattern.compile("\\[gc,plab\\s*\\] GC\\((\\d+)\\)");
6464
// Pattern for extraction pair <name>: <numeric value>
65-
private static final Pattern PAIRS_PATTERN = Pattern.compile("\\w* \\w+:\\s+\\d+");
65+
// This is a non-zero set of words separated by spaces followed by ":" and a value.
66+
private static final Pattern PAIRS_PATTERN = Pattern.compile("(?:\\w+ )*\\w+:\\s+\\d+");
6667

6768
/**
6869
* Construct LogParser object, parse log file with PLAB statistics and store it into report.
@@ -119,7 +120,7 @@ private PlabReport parseLines() throws NumberFormatException {
119120
do {
120121
String pair = matcher.group();
121122
String[] nameValue = pair.replaceAll(": ", ":").split(":");
122-
plabInfo.put(nameValue[0].trim(), Long.parseLong(nameValue[1]));
123+
plabInfo.put(nameValue[0], Long.parseLong(nameValue[1]));
123124
} while (matcher.find());
124125
}
125126
}
@@ -194,7 +195,7 @@ private Map<Long, PlabInfo> getSpecifiedStats(List<Long> gcIds, LogParser.Report
194195
getEntries().entryStream()
195196
.filter(gcLogItem -> extractId == gcIds.contains(gcLogItem.getKey()))
196197
.collect(Collectors.toMap(gcLogItem -> gcLogItem.getKey(),
197-
gcLogItem -> gcLogItem.getValue().get(type).filter(fieldNames)
198+
gcLogItem -> gcLogItem.getValue().get(type).filter(fieldNames)
198199
)
199200
)
200201
);

0 commit comments

Comments
 (0)