Skip to content

Writes to stdin not recevied directly #1768

Closed

Description

@derklaro

Hi, I'm a little stuck right now. I'm runing a java application inside a docker container and I want to send a command to it. I'm using the following code to attach to the container:

this.stdOut = new PipedOutputStream();
this.stdIn = new PipedInputStream(this.stdOut);

this.dockerClient.attachContainerCmd(this.containerId)
        .withLogs(true)
        .withStdOut(true)
        .withStdErr(true)
        .withStdIn(this.stdIn)
        .withTimestamps(false)
        .withFollowStream(true)
        .exec(new ServiceLogCacheAdapter());

Everything works fine and I can receive data written to stdout/stderr. But when I try to send data to the stdout stream the data is not received by the application until the application sends out a message to std out/err. I'm currently not sure if this is an issue on my end and I'm hoping someone can help me with this. Thanks in advance!

Activity

  1. derklaro commented on Dec 30, 2021

    @derklaro
    ContributorAuthor

    I went a bit further into this issue. It looks like the FramedInputStreamConsumer calls read on the response input stream of the request (which normally is correct). But it locks the underlying Channel waiting for input and releasing it's lock when input is available meaning that the lock gets released and the write can obtain it. 🤔

  2. added a commit that references this issue on Feb 4, 2022
    e100e25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions