Skip to content

Commit 92f35e0

Browse files
committed
Fix marshalling and Netty async bugs
- Fix hasPayloadMembers() to ensure that the shape is an event before checking for unbound event members. Otherwise, the test will always return true for any shape that has member. - For non full duplex requests, continue to perform a channel.read() call only after writing the request to avoid ReadTimeoutExceptions.
1 parent 51e5276 commit 92f35e0

File tree

2 files changed

+7
-6
lines changed
  • codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate
  • http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/internal

2 files changed

+7
-6
lines changed

codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/ShapeModel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ public List<MemberModel> getUnboundEventMembers() {
196196
public boolean hasPayloadMembers() {
197197
return hasPayloadMember ||
198198
getExplicitEventPayloadMember() != null ||
199-
getUnboundMembers().size() > 0 ||
200-
getUnboundEventMembers().size() > 0;
199+
!getUnboundMembers().isEmpty() ||
200+
(isEvent() && !getUnboundEventMembers().isEmpty());
201201
}
202202

203203
/**

http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/internal/NettyRequestExecutor.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,25 @@ private void writeRequest(HttpRequest request) {
164164
.addListener(wireCall -> {
165165
// Done writing so remove the idle write timeout handler
166166
ChannelUtils.removeIfExists(channel.pipeline(), WriteTimeoutHandler.class);
167-
if (wireCall.isSuccess()) {
167+
if (wireCall.isSuccess() && !context.executeRequest().fullDuplex()) {
168168
// Starting read so add the idle read timeout handler, removed when channel is released
169169
channel.pipeline().addFirst(new ReadTimeoutHandler(context.configuration().readTimeoutMillis(),
170170
TimeUnit.MILLISECONDS));
171+
channel.read();
172+
171173
} else {
172174
// TODO: Are there cases where we can keep the channel open?
173175
closeAndRelease(channel);
174176
handleFailure(() -> "Failed to make request to " + endpoint(), wireCall.cause());
175177
}
176178
});
177179

180+
// FullDuplex calls need to start reading at the same time we make the request.
178181
if (context.executeRequest().fullDuplex()) {
179182
channel.pipeline().addFirst(new ReadTimeoutHandler(context.configuration().readTimeoutMillis(),
180183
TimeUnit.MILLISECONDS));
184+
channel.read();
181185
}
182-
183-
// Auto-read is turned off so trigger an explicit read to give control to HttpStreamsClientHandler
184-
channel.read();
185186
}
186187

187188
private URI endpoint() {

0 commit comments

Comments
 (0)