Skip to content

Intermittent missing output on python 3.4 #67

Open

Description

@aanand

This script reliably produces output for me on Python 2.7.11, but only about 20% of the time on Python 3.4.4 (both on Mac OS X 10.10.5):

from docker import Client
from docker.utils import kwargs_from_env

from dockerpty import start, RunOperation, PseudoTerminal

client = Client(**kwargs_from_env())
container = client.create_container('alpine', ['echo', 'hello', 'world'])

operation = RunOperation(
    client,
    container['Id'],
    interactive=True,
    logs=False,
)
pty = PseudoTerminal(client, operation)
sockets = pty.sockets()
client.start(container)
pty.start(sockets)
client.wait(container)

The last stanza is modelled on how Compose uses dockerpty. I can make the script reliable by replacing it with the following:

start(client, container, interactive=True, logs=False)

I haven't yet investigated any further.

Activity

  1. dnephin commented on Jul 3, 2016

    @dnephin
    Collaborator
    client.start(container)
    pty.start(sockets)

    This seems like a potential race, right? Logs can be missed if they are printed before the pty.start() connects.

    I'm not sure why it works with python2.

  2. aanand commented on Jul 5, 2016

    @aanand
    CollaboratorAuthor

    I don't think so. pty.sockets() opens the HTTP connections. pty.start() just hooks them up to stdin/out/err.

  3. dnephin commented on Jul 6, 2016

    @dnephin
    Collaborator

    Ah right, I forgot we worked that out. Thanks

  4. cclauss commented on Apr 11, 2017

    @cclauss

    Is this issue still open?

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions