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

Clean up netty residual memory when the stream is closed #14199

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,9 @@ public void disableAutoFlowControl() {
public boolean isAutoRequestN() {
return autoRequestN;
}

public void onStreamClosed() {
closed = true;
streamingDecoder.onStreamClosed();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ public final void close() {
deliver();
}

@Override
public final void onStreamClosed() {
if (closed) {
return;
}
closed = true;
try {
accumulate.close();
} catch (IOException e) {
throw new DecodeException(e);
}
}

@Override
public final void setFragmentListener(FragmentListener listener) {
this.listener = listener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public void close() {
this.listener.onClose();
}

@Override
public void onStreamClosed() {
// do nothing
}

@Override
public void setFragmentListener(FragmentListener listener) {
this.listener = listener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public interface StreamingDecoder {

void close();

void onStreamClosed();

void setFragmentListener(FragmentListener listener);

interface FragmentListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ protected final Http2ServerChannelObserver getServerChannelObserver() {
@Override
public void onStreamClosed() {
// doing on event loop thread
getStreamingDecoder().close();
getServerChannelObserver().onStreamClosed();
}

private static class Http2StreamingDecodeListener implements ListeningDecoder.Listener {
Expand Down
Loading