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

[UNDERTOW-1602] Don't immediatly attempt to resume if parsing was uns… #821

Merged
merged 2 commits into from
Oct 16, 2019
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 @@ -486,7 +486,7 @@ protected AbstractHttp2StreamSourceChannel createChannelImpl(FrameHeaderData fra
boolean ack = Bits.anyAreSet(frameParser.flags, PING_FLAG_ACK);
channel = new Http2PingStreamSourceChannel(this, pingParser.getData(), ack);
if(!ack) { //not an ack from one of our pings, so send it back
sendPing(pingParser.getData(), null, true);
sendPing(pingParser.getData(), new Http2ControlMessageExceptionHandler(), true);
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ public abstract class AbstractFramedChannel<C extends AbstractFramedChannel<C, R
private final List<ChannelListener<C>> closeTasks = new CopyOnWriteArrayList<>();
private volatile boolean flushingSenders = false;

private boolean partialRead = false;

@SuppressWarnings("unused")
private volatile int outstandingBuffers;
private static final AtomicIntegerFieldUpdater<AbstractFramedChannel> outstandingBuffersUpdater = AtomicIntegerFieldUpdater.newUpdater(AbstractFramedChannel.class, "outstandingBuffers");
Expand Down Expand Up @@ -352,6 +354,7 @@ public synchronized R receive() throws IOException {
channel.getSourceChannel().shutdownReads();
return null;
}
partialRead = false;
boolean requiresReinvoke = false;
int reinvokeDataRemaining = 0;
ReferenceCountedPooled pooled = this.readData;
Expand Down Expand Up @@ -470,6 +473,9 @@ public synchronized R receive() throws IOException {
}
return newChannel;
}
} else {
//we set partial read to true so the read listener knows not to immediately call receive again
partialRead = true;
}
return null;
} catch (IOException|RuntimeException|Error e) {
Expand Down Expand Up @@ -943,7 +949,11 @@ public void handleEvent(final StreamSourceChannel channel) {
UndertowLogger.REQUEST_IO_LOGGER.tracef("Invoking receive listener", receiver);
ChannelListeners.invokeChannelListener(AbstractFramedChannel.this, listener);
}
if (readData != null && !readData.isFreed() && channel.isOpen()) {
final boolean partialRead;
synchronized (AbstractFramedChannel.this) {
partialRead = AbstractFramedChannel.this.partialRead;
}
if (readData != null && !readData.isFreed() && channel.isOpen() && !partialRead) {
try {
runInIoThread(new Runnable() {
@Override
Expand All @@ -955,6 +965,9 @@ public void run() {
IoUtils.safeClose(AbstractFramedChannel.this);
}
}
synchronized (AbstractFramedChannel.this) {
AbstractFramedChannel.this.partialRead = false;
}
}
}

Expand Down