Skip to content

Use IsServing to determine if c8d client is ready#41228

Merged
thaJeztah merged 2 commits into
moby:masterfrom
cpuguy83:better_event_wait
Sep 10, 2020
Merged

Use IsServing to determine if c8d client is ready#41228
thaJeztah merged 2 commits into
moby:masterfrom
cpuguy83:better_event_wait

Conversation

@cpuguy83

Copy link
Copy Markdown
Member

Instead of sleeping an arbitrary amount of time, using the client to
tell us when it's ready so we can start processing events sooner.

@cpuguy83
cpuguy83 requested review from thaJeztah and tonistiigi July 17, 2020 20:40
@cpuguy83
cpuguy83 force-pushed the better_event_wait branch from dc5bd1b to f65d271 Compare July 17, 2020 20:41
@thaJeztah thaJeztah added area/runtime Runtime kind/refactor PR's that refactor, or clean-up code status/2-code-review labels Jul 20, 2020
@cpuguy83
cpuguy83 force-pushed the better_event_wait branch from 58ada30 to 41537e2 Compare July 28, 2020 17:17
Comment thread libcontainerd/remote/client.go Outdated
Comment on lines 726 to 731

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.

Wondering if if would be useful to return the error (and log it?) instead of returning a boolean; so err == nil means "yup, it's up now", and err != nil means something went wrong

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I can do a better job at checking the error from IsServing and logging cases that are not context related.

I don't think returning an error here is what we want though, since this should loop forever until the condition is true or the context is cancelled.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated this.

@thaJeztah

Copy link
Copy Markdown
Member

@tonistiigi @AkihiroSuda PTAL

Instead of sleeping an arbitrary amount of time, using the client to
tell us when it's ready so we can start processing events sooner.

Signed-off-by: Brian Goff <[email protected]>
The event subscriber can only be cancelled by cancelling the context.
In the case where we have to restart event processing we are never
cancelling the old subscribiption.

Signed-off-by: Brian Goff <[email protected]>
@thaJeztah

Copy link
Copy Markdown
Member

Interesting failure; shouldn't -f ignore non-existing containers? 🤔

=== RUN   TestDockerSuite/TestRunMutableNetworkFiles
    --- FAIL: TestDockerSuite/TestRunMutableNetworkFiles (0.03s)
        cli.go:29: assertion failed: 
            Command:  /usr/local/cli/docker rm -fv 798c9471b695
            ExitCode: 1
            Error:    exit status 1
            Stdout:   
            Stderr:   Error response from daemon: No such container: 798c9471b695
            
            
            Failures:
            ExitCode was 1 expected 0
            Expected no error
$ docker rm -fv 798c9471b695
Error: No such container: 798c9471b695
$ echo $?
1

Apparently we don't ignore that (wondering if that's a bug / oversight, or if it was "by design" and not something we could change)

@tonistiigi tonistiigi 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.

sgtm

@thaJeztah thaJeztah 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.

LGTM

@thaJeztah
thaJeztah merged commit 4a44eaf into moby:master Sep 10, 2020
@thaJeztah thaJeztah added this to the 20.03.0 milestone Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/runtime Runtime kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants