Skip to content

Navigation Menu

Sign in
Appearance settings
Sign up
Appearance settings

Shutdown hijacked stdin - #1567

#1567
Open
bsideup wants to merge 2 commits into
maindocker-java/docker-java:mainfrom
close_hijacked_stdindocker-java/docker-java:close_hijacked_stdinCopy head branch name to clipboard
Open

Shutdown hijacked stdin#1567
bsideup wants to merge 2 commits into
maindocker-java/docker-java:mainfrom
close_hijacked_stdindocker-java/docker-java:close_hijacked_stdinCopy head branch name to clipboard

Conversation

@bsideup

@bsideup bsideup commented Mar 26, 2021

Copy link
Copy Markdown
Member

Fixes #1448


This change is Reviewable

@bsideup

bsideup commented Mar 29, 2021

Copy link
Copy Markdown
Member Author

It looks like there are two challenges with this:

  1. OkHttp + TCP transport does not pass
  2. Npipe does not implement shutdownOutput properly

putting on hold for now

@luneo7

luneo7 commented May 13, 2022

Copy link
Copy Markdown

Tested you branch and just changing com.github.dockerjava.okhttp.HijackingInterceptor thread to something like

Thread thread = new Thread(() -> {
    try {
        try (BufferedSink sink = streams.sink) {
            while (sink.isOpen()) {
                int aByte = stdin.read();
                if (aByte < 0) {
                    break;
                }
                sink.writeByte(aByte);
                sink.emit();
            }
        }
        Connection connection = chain.connection();
        if (connection != null) {
            connection.socket().shutdownOutput();
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
});

Makes it work with Okhttp3 =]

@eddumelendez
eddumelendez requested a review from a team as a code owner August 19, 2025 18:23
@mikehearn

Copy link
Copy Markdown

Just hit this! Even just fixing it for some backends would be great. BTW the zerodeps backend has the same issue.

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.

Stdin remains open in Docker container after closing it on docker-java side via OkHttp

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.