Skip to content

Commit

Permalink
Merge master jdk-17.0.13+3 into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <[email protected]>
  • Loading branch information
j9build committed Aug 15, 2024
2 parents b5d1ec3 + 87a838b commit c4444cb
Show file tree
Hide file tree
Showing 67 changed files with 2,049 additions and 218 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,26 +344,23 @@ jobs:
- test-windows-x64

steps:
# Hack to get hold of the api environment variables that are only defined for actions
- name: 'Get API configuration'
id: api
uses: actions/github-script@v7
with:
script: 'return { url: process.env["ACTIONS_RUNTIME_URL"], token: process.env["ACTIONS_RUNTIME_TOKEN"] }'

- name: 'Remove bundle artifacts'
run: |
# Find and remove all bundle artifacts
ALL_ARTIFACT_URLS="$(curl -s \
-H 'Accept: application/json;api-version=6.0-preview' \
-H 'Authorization: Bearer ${{ fromJson(steps.api.outputs.result).token }}' \
'${{ fromJson(steps.api.outputs.result).url }}_apis/pipelines/workflows/${{ github.run_id }}/artifacts?api-version=6.0-preview')"
BUNDLE_ARTIFACT_URLS="$(echo "$ALL_ARTIFACT_URLS" | jq -r -c '.value | map(select(.name|startswith("bundles-"))) | .[].url')"
for url in $BUNDLE_ARTIFACT_URLS; do
echo "Removing $url"
curl -s \
-H 'Accept: application/json;api-version=6.0-preview' \
-H 'Authorization: Bearer ${{ fromJson(steps.api.outputs.result).token }}' \
-X DELETE "$url" \
# See: https://docs.github.com/en/rest/actions/artifacts?apiVersion=2022-11-28
ALL_ARTIFACT_IDS="$(curl -sL \
-H 'Accept: application/vnd.github+json' \
-H 'Authorization: Bearer ${{ github.token }}' \
-H 'X-GitHub-Api-Version: 2022-11-28' \
'${{ github.api_url }}/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts')"
BUNDLE_ARTIFACT_IDS="$(echo "$ALL_ARTIFACT_IDS" | jq -r -c '.artifacts | map(select(.name|startswith("bundles-"))) | .[].id')"
for id in $BUNDLE_ARTIFACT_IDS; do
echo "Removing $id"
curl -sL \
-X DELETE \
-H 'Accept: application/vnd.github+json' \
-H 'Authorization: Bearer ${{ github.token }}' \
-H 'X-GitHub-Api-Version: 2022-11-28' \
"${{ github.api_url }}/repos/${{ github.repository }}/actions/artifacts/$id" \
|| echo "Failed to remove bundle"
done
4 changes: 3 additions & 1 deletion make/autoconf/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,11 @@ AC_OUTPUT

# After AC_OUTPUT, we need to do final work
CUSTOM_CONFIG_OUTPUT_GENERATED_HOOK
BASIC_POST_CONFIG_OUTPUT

# Finally output some useful information to the user
HELP_PRINT_SUMMARY_AND_WARNINGS
CUSTOM_SUMMARY_AND_WARNINGS_HOOK
HELP_REPEAT_WARNINGS

# All output is done. Do the post-config output management.
BASIC_POST_CONFIG_OUTPUT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -27,6 +27,8 @@

import java.io.*;
import java.net.*;
import java.util.Objects;

import com.sun.net.httpserver.*;
import com.sun.net.httpserver.spi.*;

Expand Down Expand Up @@ -77,6 +79,10 @@ public void write (int b) throws IOException {
}

public void write (byte[]b, int off, int len) throws IOException {
Objects.checkFromIndexSize(off, len, b.length);
if (len == 0) {
return;
}
if (closed) {
throw new StreamClosedException ();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -240,6 +240,7 @@ public void sendResponseHeaders (int rCode, long contentLen)
}
noContentToSend = true;
contentLen = 0;
o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen));
} else { /* not a HEAD request or 304 response */
if (contentLen == 0) {
if (http10) {
Expand Down Expand Up @@ -282,9 +283,7 @@ public void sendResponseHeaders (int rCode, long contentLen)
sentHeaders = true;
logger.log(Level.TRACE, "Sent headers: noContentToSend=" + noContentToSend);
if (noContentToSend) {
WriteFinishedEvent e = new WriteFinishedEvent (this);
server.addEvent (e);
closed = true;
close();
}
server.logReply (rCode, req.requestLine(), null);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -27,6 +27,8 @@

import java.io.*;
import java.net.*;
import java.util.Objects;

import com.sun.net.httpserver.*;
import com.sun.net.httpserver.spi.*;

Expand All @@ -41,7 +43,6 @@
class FixedLengthOutputStream extends FilterOutputStream
{
private long remaining;
private boolean eof = false;
private boolean closed = false;
ExchangeImpl t;

Expand All @@ -58,22 +59,21 @@ public void write (int b) throws IOException {
if (closed) {
throw new IOException ("stream closed");
}
eof = (remaining == 0);
if (eof) {
if (remaining == 0) {
throw new StreamClosedException();
}
out.write(b);
remaining --;
}

public void write (byte[]b, int off, int len) throws IOException {
Objects.checkFromIndexSize(off, len, b.length);
if (len == 0) {
return;
}
if (closed) {
throw new IOException ("stream closed");
}
eof = (remaining == 0);
if (eof) {
throw new StreamClosedException();
}
if (len > remaining) {
// stream is still open, caller can retry
throw new IOException ("too many bytes to write to stream");
Expand All @@ -92,7 +92,6 @@ public void close () throws IOException {
throw new IOException ("insufficient bytes written to stream");
}
flush();
eof = true;
LeftOverInputStream is = t.getOriginalInputStream();
if (!is.isClosed()) {
try {
Expand Down
39 changes: 21 additions & 18 deletions src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,14 @@ public void run () {
return;
}
String uriStr = requestLine.substring (start, space);
URI uri = new URI (uriStr);
URI uri;
try {
uri = new URI (uriStr);
} catch (URISyntaxException e3) {
reject(Code.HTTP_BAD_REQUEST,
requestLine, "URISyntaxException thrown");
return;
}
start = space+1;
String version = requestLine.substring (start);
Headers headers = req.headers();
Expand Down Expand Up @@ -732,7 +739,13 @@ public void run () {
} else {
headerValue = headers.getFirst("Content-Length");
if (headerValue != null) {
clen = Long.parseLong(headerValue);
try {
clen = Long.parseLong(headerValue);
} catch (NumberFormatException e2) {
reject(Code.HTTP_BAD_REQUEST,
requestLine, "NumberFormatException thrown");
return;
}
if (clen < 0) {
reject(Code.HTTP_BAD_REQUEST, requestLine,
"Illegal Content-Length value");
Expand Down Expand Up @@ -818,20 +831,11 @@ public void run () {
uc.doFilter (new HttpExchangeImpl (tx));
}

} catch (IOException e1) {
logger.log (Level.TRACE, "ServerImpl.Exchange (1)", e1);
closeConnection(connection);
} catch (NumberFormatException e2) {
logger.log (Level.TRACE, "ServerImpl.Exchange (2)", e2);
reject (Code.HTTP_BAD_REQUEST,
requestLine, "NumberFormatException thrown");
} catch (URISyntaxException e3) {
logger.log (Level.TRACE, "ServerImpl.Exchange (3)", e3);
reject (Code.HTTP_BAD_REQUEST,
requestLine, "URISyntaxException thrown");
} catch (Exception e4) {
logger.log (Level.TRACE, "ServerImpl.Exchange (4)", e4);
closeConnection(connection);
} catch (Exception e) {
logger.log (Level.TRACE, "ServerImpl.Exchange", e);
if (tx == null || !tx.writefinished) {
closeConnection(connection);
}
} catch (Throwable t) {
logger.log(Level.TRACE, "ServerImpl.Exchange (5)", t);
throw t;
Expand All @@ -856,9 +860,8 @@ void reject (int code, String requestStr, String message) {
rejected = true;
logReply (code, requestStr, message);
sendReply (
code, false, "<h1>"+code+Code.msg(code)+"</h1>"+message
code, true, "<h1>"+code+Code.msg(code)+"</h1>"+message
);
closeConnection(connection);
}

void sendReply (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -27,6 +27,8 @@

import java.io.*;
import java.net.*;
import java.util.Objects;

import com.sun.net.httpserver.*;
import com.sun.net.httpserver.spi.*;

Expand Down Expand Up @@ -55,6 +57,10 @@ public void write (int b) throws IOException {
}

public void write (byte[]b, int off, int len) throws IOException {
Objects.checkFromIndexSize(off, len, b.length);
if (len == 0) {
return;
}
if (closed) {
throw new IOException ("stream closed");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -57,7 +57,11 @@ public static void runTest() throws Throwable {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:ReservedCodeCacheSize=2496k", "-XX:-UseCodeCacheFlushing", "CodeCacheFullCountTest", "WasteCodeCache");
OutputAnalyzer oa = ProcessTools.executeProcess(pb);
oa.shouldHaveExitValue(0);
// Ignore adapter creation failures
if (oa.getExitValue() != 0 && !oa.getStderr().contains("Out of space in CodeCache for adapters")) {
oa.reportDiagnosticSummary();
throw new RuntimeException("VM finished with exit code " + oa.getExitValue());
}
String stdout = oa.getStdout();

Pattern pattern = Pattern.compile("full_count=(\\d)");
Expand Down
19 changes: 10 additions & 9 deletions test/hotspot/jtreg/gc/g1/plab/lib/LogParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
*
* Typical GC log with PLAB statistics (options - -Xlog:gc=debug,gc+plab=debug) looks like:
*
* [0.330s][debug][gc,plab ] GC(0) Young PLAB allocation: allocated: 1825632B, wasted: 29424B, unused: 2320B, used: 1793888B, undo waste: 0B,
* [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
* [0.330s][debug][gc,plab ] GC(0) Young sizing: calculated: 358776B, actual: 358776B
* [0.330s][debug][gc,plab ] GC(0) Old PLAB allocation: allocated: 427248B, wasted: 592B, unused: 368584B, used: 58072B, undo waste: 0B,
* [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
* [0.330s][debug][gc,plab ] GC(0) Old sizing: calculated: 11608B, actual: 11608B
* [0.192s][debug][gc,plab ] GC(0) Young PLAB allocation: allocated: 2867184B, wasted: 656B, unused: 252896B, used: 2613632B, undo waste: 0B,
* [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
* [0.192s][debug][gc,plab ] GC(0) Young sizing: calculated: 522720B, actual: 522720B
* [0.192s][debug][gc,plab ] GC(0) Old PLAB allocation: allocated: 0B, wasted: 0B, unused: 0B, used: 0B, undo waste: 0B,
* [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
* [0.192s][debug][gc,plab ] GC(0) Old sizing: calculated: 0B, actual: 2064B
*/
final public class LogParser {

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

/**
* Construct LogParser object, parse log file with PLAB statistics and store it into report.
Expand Down Expand Up @@ -119,7 +120,7 @@ private PlabReport parseLines() throws NumberFormatException {
do {
String pair = matcher.group();
String[] nameValue = pair.replaceAll(": ", ":").split(":");
plabInfo.put(nameValue[0].trim(), Long.parseLong(nameValue[1]));
plabInfo.put(nameValue[0], Long.parseLong(nameValue[1]));
} while (matcher.find());
}
}
Expand Down Expand Up @@ -194,7 +195,7 @@ private Map<Long, PlabInfo> getSpecifiedStats(List<Long> gcIds, LogParser.Report
getEntries().entryStream()
.filter(gcLogItem -> extractId == gcIds.contains(gcLogItem.getKey()))
.collect(Collectors.toMap(gcLogItem -> gcLogItem.getKey(),
gcLogItem -> gcLogItem.getValue().get(type).filter(fieldNames)
gcLogItem -> gcLogItem.getValue().get(type).filter(fieldNames)
)
)
);
Expand Down
Loading

0 comments on commit c4444cb

Please sign in to comment.