Skip to content

Commit

Permalink
8303481: CancelRequestTest assertTrue failing with AssertionError due…
Browse files Browse the repository at this point in the history
… to java.util.concurrent.CompletionException: java.io.EOFException: EOF reached while reading

Reviewed-by: jpai, djelinski
  • Loading branch information
dfuch committed Mar 3, 2023
1 parent 8bf084c commit cbdc7a6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Expand Up @@ -80,4 +80,8 @@ public HttpHeaders getSystemHeaders() {
return system;
}

@Override
public String toString() {
return "OutgoingHeaders()";
}
}
Expand Up @@ -828,7 +828,10 @@ void readLoop() {
throw new IOException("Unexpected frame");
}
} else {
q.put(frame);
if (!q.putIfOpen(frame)) {
System.err.printf("Stream %s is closed: dropping %s%n",
stream, frame);
}
}
}
}
Expand Down
Expand Up @@ -58,17 +58,24 @@ public synchronized boolean isClosing() {
return closing;
}

public synchronized boolean isOpen() {
return !closed && !closing;
}

public synchronized void put(T obj) throws IOException {
Objects.requireNonNull(obj);
if (closed || closing) {
if (!putIfOpen(obj)) {
throw new IOException("stream closed");
}
}

public synchronized boolean putIfOpen(T obj) {
Objects.requireNonNull(obj);
if (!isOpen()) return false;
q.add(obj);

if (waiters > 0) {
notifyAll();
}
return true;
}

// Other close() variants are immediate and abortive
Expand Down

1 comment on commit cbdc7a6

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.