FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Preserve the order of requests to Docker daemon using DefaultInvocationBuilder (#1492) by tejksat · Pull Request #1494 · docker-java/docker-java · GitHub

Repository navigation

Preserve the order of requests to Docker daemon using DefaultInvocationBuilder (#1492) - #1494

Merged
bsideup merged 6 commits into
docker-java:masterfrom
tejksat:alexander.koshevoy/guaranteeConsecutiveRequestsWithDefaultInvocationBuilder
Nov 16, 2020
Merged

bsideup merged 6 commits into
docker-java:masterfrom
tejksat:alexander.koshevoy/guaranteeConsecutiveRequestsWithDefaultInvocationBuilder

Conversation

tejksat commented Nov 16, 2020 •
edited
Loading

Copy link
Copy Markdown
Contributor

The problem is that using awaitStarted() on attach's callback on a non-running container leads to the infinite wait for Jersey transport implementation.

This happens when SelectiveLoggingFilter is used in DefaultInvocationBuilder where it is created with printEntity = true parameter. In this case the implementation of ClientResponseFilter.filter(...) method in the base LoggingFilter class blocks at responseContext.hasEntity() until the data is available in the response. This happens because hasEntity() reads a single byte to check whether there is any data available in the stream. In the case of attach command this method blocks until there is data in stdout/stderr streams. Having data from the streams requires container running, which we cannot do safely without awaitStarted() because attach command is performed in a separate thread and we need to run start only after attach request is executed not to loose the data from stdout/stderr streams.

thread.start();

try {
onStart.await();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

callback's onStart should be used to detect started operation. Blocking here is an unexpected behaviour change

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

also see awaitStarted on ResultCallbackTemplate

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sorry for the possible confusion: onStart is CountDownLatch here actually. I will rename it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

my point is that DefaultInvocationBuilder should not be changed. Instead, the callee should use awaitStarted() or similar means

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thank you, I got it now. I thought there will be inconsistency with other post and get methods of DefaultInvocationBuilder which do not accept ResultCallback as a parameter. The requests in these cases are executed in the same thread and awaitStarted() is not required. But this is the expected behavior?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Those that have no ResultCallback as a parameter are blocking methods, while ResultCallback-based ones are kinda asynchronous, hence no blocking behaviour

bsideup left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

👍

`attachContainerStdinUnsupported()` test requires neither starting the container nor waiting on `awaitStarted()` of attach's callback.
Restore starting the container in the test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL