Skip to content

Refactor State to be 100% thread safe#2798

Merged
crosbymichael merged 1 commit intomasterfrom
fix_state_race
Nov 22, 2013
Merged

Refactor State to be 100% thread safe#2798
crosbymichael merged 1 commit intomasterfrom
fix_state_race

Conversation

@creack
Copy link
Copy Markdown
Contributor

@creack creack commented Nov 21, 2013

No description provided.

@pnasrat
Copy link
Copy Markdown
Contributor

pnasrat commented Nov 21, 2013

# github.com/dotcloud/docker
./links_test.go:24: unknown State field 'Running' in struct literal
./links_test.go:69: unknown State field 'Running' in struct literal

@pnasrat
Copy link
Copy Markdown
Contributor

pnasrat commented Nov 21, 2013

@pnasrat
Copy link
Copy Markdown
Contributor

pnasrat commented Nov 21, 2013

Another build failure is

# github.com/dotcloud/docker/integration
./commands_test.go:292: container.State.Running undefined (type docker.State has no field or method Running)
./commands_test.go:322: l[0].State.Running undefined (type docker.State has no field or method Running)
./commands_test.go:348: container.State.Running undefined (type docker.State has no field or method Running)
./commands_test.go:457: container.State.Running undefined (type docker.State has no field or method Running)
./commands_test.go:537: container.State.Running undefined (type docker.State has no field or method Running)
./commands_test.go:599: container.State.Running undefined (type docker.State has no field or method Running)
./commands_test.go:632: l[0].State.Running undefined (type docker.State has no field or method Running)
./commands_test.go:668: container.State.Running undefined (type docker.State has no field or method Running)
./container_test.go:227: container1.State.Running undefined (type docker.State has no field or method Running)
./container_test.go:233: container1.State.Running undefined (type docker.State has no field or method Running)
./container_test.go:233: too many errors
FAIL    github.com/dotcloud/docker/integration [build failed]

@creack
Copy link
Copy Markdown
Contributor Author

creack commented Nov 21, 2013

@pnasrat sorry about that, I open the PR before running the test (building the docker image). Now everything compiles, but sitll have 2 failure.

@creack
Copy link
Copy Markdown
Contributor Author

creack commented Nov 21, 2013

All tests now pass. Ping @crosbymichael @vieux

Comment thread state.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why did you add .UTC() ?

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.

So that way, no matter where you run docker, the date will be consistent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't you think it ca create some issue when we display it in docker ps ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@vieux If the time zone of the host changes, it might cause problems when the time zone has to be converted from one non-UTC time zone to another non-UTC time zone.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@creack @unclejack True but I don't think this is the pull request to make a change like this. It is out of the scope and could cause issues if users are relying on their local time.

@vieux
Copy link
Copy Markdown
Contributor

vieux commented Nov 21, 2013

I got:

=== RUN TestAttachDetach
--- FAIL: TestAttachDetach (2.32 seconds)
        commands_test.go:510: Impossible to attach to a stopped container, start it first
        commands_test.go:47: First read/write assertion timed out
=== RUN TestAttachDetachTruncatedID
--- FAIL: TestAttachDetachTruncatedID (2.33 seconds)
        commands_test.go:572: Impossible to attach to a stopped container, start it first
        commands_test.go:47: First read/write assertion timed out
=== RUN TestAttachDisconnect
--- FAIL: TestAttachDisconnect (2.06 seconds)
        commands_test.go:47: First read/write assertion timed out
=== RUN TestReloadContainerLinks
--- FAIL: TestReloadContainerLinks (6.42 seconds)
    runtime_test.go:677: Expected 2 container alive, 0 found

Note that TestAttachDetach and TestAttachDetachTruncatedID errors are not the same in master

@unclejack
Copy link
Copy Markdown
Contributor

I'm seeing something similar:

--- FAIL: TestAttachDetach (2.35 seconds)
        commands_test.go:518: Unexpected output. Expected [hello], received [hellohello]
        commands_test.go:47: First read/write assertion timed out
--- FAIL: TestAttachDetachTruncatedID (2.36 seconds)
        commands_test.go:580: Unexpected output. Expected [hello], received [hellohello]
        commands_test.go:47: First read/write assertion timed out

@creack
Copy link
Copy Markdown
Contributor Author

creack commented Nov 21, 2013

@unclejack This is an other race. @vieux can you make sure you have the latest commit and try again the first 2 tests?
The 2 other seems non related, I"ll take a look

@vieux
Copy link
Copy Markdown
Contributor

vieux commented Nov 21, 2013

@unclejack those are unrelated hellos are unrelated, they also happen sometimes on master

@unclejack
Copy link
Copy Markdown
Contributor

@vieux @creack Got it, I thought they were worth mentioning since they looked different without this PR and they seem to be failing consistently for me.

@pnasrat
Copy link
Copy Markdown
Contributor

pnasrat commented Nov 22, 2013

It's possible we've made another race more determistic!

Could someone do a PR to comment all the tests that are known flaky?

Paul

On 21 November 2013 18:59, unclejack [email protected] wrote:

@vieux https://github.com/vieux @creack https://github.com/creack Got
it, I thought they were worth mentioning since they looked different
without this PR and they seem to be failing consistently for me.


Reply to this email directly or view it on GitHubhttps://github.com//pull/2798#issuecomment-29037167
.

@vieux
Copy link
Copy Markdown
Contributor

vieux commented Nov 22, 2013

I just succesfully passed the tests. I didn't have the last version.

TestAttachDetach fails randomly, like on master

LGTM

On Thu, Nov 21, 2013 at 4:01 PM, Paul Nasrat [email protected]:

It's possible we've made another race more determistic!

Could someone do a PR to comment all the tests that are known flaky?

Paul

On 21 November 2013 18:59, unclejack [email protected] wrote:

@vieux https://github.com/vieux @creack https://github.com/creack
Got
it, I thought they were worth mentioning since they looked different
without this PR and they seem to be failing consistently for me.


Reply to this email directly or view it on GitHub<
https://github.com/dotcloud/docker/pull/2798#issuecomment-29037167>
.


Reply to this email directly or view it on GitHubhttps://github.com//pull/2798#issuecomment-29037260
.

Victor VIEUX
http://vvieux.com

Comment thread state.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove UTC

@creack
Copy link
Copy Markdown
Contributor Author

creack commented Nov 22, 2013

ping @crosbymichael, I'll make a separate PR for UTC

@crosbymichael
Copy link
Copy Markdown
Contributor

LGTM

crosbymichael added a commit that referenced this pull request Nov 22, 2013
Refactor State to be 100% thread safe
@crosbymichael crosbymichael merged commit 25e443a into master Nov 22, 2013
@crosbymichael crosbymichael deleted the fix_state_race branch November 22, 2013 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants