Skip to content

Conversation

@aajtodd
Copy link
Contributor

@aajtodd aajtodd commented Aug 24, 2021

Issue #

fixes #282

Description of changes

Provide a means to allow ByteStream.Streaming inputs to be consumed by the CRT. The ticket has more details on the issue but basically the proxy coroutine we were using previously would launch, fill as much as could be read, then suspend waiting for more data. The CRT would start reading and then basically starve the dispatcher such that the proxy coroutine was never able to make progress (and since the proxy coroutine is the one that could unblock the CRT to make progress it results in an infinite loop).

This solution is not efficient but it does work. Instead we launch a coroutine on demand when we know there is data available to read. The coroutine is launched undispatched which means it will run to the first suspension point (which we won't hit because we know there is data available).

The previously failing e2eTest now passes.

Scope

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@aajtodd aajtodd requested review from ianbotsf and kggilmer August 24, 2021 19:41
Copy link
Contributor

@ianbotsf ianbotsf left a comment

Choose a reason for hiding this comment

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

Minor issue otherwise looks good.

Comment on lines +107 to +110
testLogging {
events("passed", "skipped", "failed")
showStandardStreams = true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix: Generally we shouldn't show full output on passed tests. Was this left in here for debug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the same settings we use everywhere else:

I'm in favor of leaving it since most of our tests aren't printing anything anyway and it allows easier debugging if you do without changing build settings.

Copy link
Contributor

Choose a reason for hiding this comment

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

It appears there is precedent. Very well, my concern for this PR is addressed.

// see: https://github.com/awslabs/aws-sdk-kotlin/issues/282
//
// TODO - we could get rid of this extra copy + coroutine if readAvailable() had a non-suspend version
// see: https://youtrack.jetbrains.com/issue/KTOR-2772
Copy link
Contributor

Choose a reason for hiding this comment

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

side question

doesn't look like this ticket is getting much love. perhaps something to bring up in our next meeting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

perhaps, we could also probably go submit a PR if we felt the need

@aajtodd aajtodd merged commit 8255143 into main Aug 25, 2021
@aajtodd aajtodd deleted the fix-body-stream branch August 25, 2021 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming request BodyStream never read

3 participants