-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Issue #8211 - fix ISE from HttpChannelState if failure during process #8215
Changes from 7 commits
5253641
0764d55
7b9c95a
37806e1
ff2fe33
9be265d
087f7aa
2e51082
7bf1561
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -663,8 +663,9 @@ public void run() | |
{ | ||
failure = x; | ||
} | ||
|
||
if (failure != null) | ||
request._callback.failed(failure); | ||
_request._callback.ensureCompleted(failure); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure I understand this. With the current modifications, the original code calling |
||
|
||
HttpStream stream; | ||
boolean completeStream; | ||
|
@@ -1299,6 +1300,7 @@ private static class ChannelCallback implements Callback | |
|
||
private final ChannelRequest _request; | ||
private Throwable _completedBy; | ||
private boolean _completed = false; | ||
|
||
private ChannelCallback(ChannelRequest request) | ||
{ | ||
|
@@ -1317,6 +1319,10 @@ public void succeeded() | |
boolean completeStream; | ||
try (AutoLock ignored = _request._lock.lock()) | ||
{ | ||
if (_completed) | ||
return; | ||
_completed = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would not do this check here. |
||
|
||
lockedOnComplete(); | ||
httpChannelState = _request._httpChannel; | ||
completeStream = httpChannelState._processState == ProcessState.PROCESSED && httpChannelState._writeState == WriteState.LAST_WRITE_COMPLETED; | ||
|
@@ -1377,6 +1383,10 @@ public void failed(Throwable failure) | |
boolean completeStream; | ||
try (AutoLock ignored = _request._lock.lock()) | ||
{ | ||
if (_completed) | ||
return; | ||
_completed = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
|
||
lockedOnComplete(); | ||
|
||
httpChannelState = _request._httpChannel; | ||
|
@@ -1439,6 +1449,25 @@ private void lockedOnComplete() | |
httpChannelState._completed = true; | ||
} | ||
|
||
public void ensureCompleted(Throwable failure) | ||
{ | ||
HttpChannelState httpChannel = _request._httpChannel; | ||
if (httpChannel != null) | ||
{ | ||
try (AutoLock ignored = httpChannel._lock.lock()) | ||
{ | ||
if (!httpChannel._completed) | ||
{ | ||
failed(failure); | ||
return; | ||
} | ||
} | ||
} | ||
|
||
if (LOG.isDebugEnabled()) | ||
LOG.debug("Process failed", failure); | ||
} | ||
|
||
@Override | ||
public InvocationType getInvocationType() | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for
final
, here and below.