provider/ec2: LiveTests.TestBootstrapWithDefaultSeries is broken
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
juju-core |
Invalid
|
High
|
Ian Booth |
Bug Description
I see the following output when running live tests against provider/ec2.
What seems to be happening is that tools.StorageName
is returning a different name than is actually used when uploading.
Looking at the code, there is a global variable changed by SetToolPrefix, which
is called when uploading. This:
a) is thread-unsafe, because it's not guarded with a mutex
b) is thread-unsafe even if it *was* guarded with a mutex, because the variable actually
relates to one particular storage only.
c) violates assumptions in various parts of the code that tools.StorageName
returns the name that will be used.
0:03.118 START: live_test.go:81: LiveTests.
0:03.131 [LOG] 36.85478 INFO juju.provider.ec2 opening environment "sample-
0:03.149 [LOG] 36.85478 INFO juju environs/testing: uploading FAKE tools 1.15.0-raring-amd64
0:04.352 [LOG] 36.85478 INFO juju environs/testing: uploading FAKE tools 1.15.0-
0:04.904 PASS: live_test.go:81: LiveTests.
0:04.904
0:04.904 START: live_test.go:1: LiveTests.
0:04.904 START: live_test.go:109: LiveTests.SetUpTest
0:04.904 PASS: live_test.go:109: LiveTests.SetUpTest 0.000s
0:04.904
0:04.937 [LOG] 36.85478 INFO juju.provider.ec2 opening environment "sample-
0:04.985 [LOG] 36.85478 INFO juju environs/testing: uploading FAKE tools 1.15.0-raring-amd64
0:04.985 [LOG] 36.85478 INFO juju environs/testing: uploading FAKE tools 1.15.0-
0:05.004 [LOG] 36.85478 DEBUG juju.environs.sync Uploading tools for []
0:05.005 [LOG] 36.85478 DEBUG juju.environs.tools looking for: /tmp/go-
0:05.005 [LOG] 36.85478 DEBUG juju.environs.tools checking: /tmp/go-
0:05.005 [LOG] 36.85478 INFO juju.environs.tools couldn't find existing jujud
0:05.005 [LOG] 36.85478 DEBUG juju.environs.tools copy existing failed: stat /tmp/go-
0:05.005 [LOG] 36.85478 INFO juju.environs.tools building jujud
0:08.946 [LOG] 36.85478 DEBUG juju.environs.tools forcing version to 1.15.0
0:08.954 [LOG] 36.85478 DEBUG juju.environs.tools adding entry: &tar.Header{
0:08.963 [LOG] 36.85478 DEBUG juju.environs.tools adding entry: &tar.Header{
0:11.468 [LOG] 36.85478 INFO juju.environs.sync built 1.15.0-raring-amd64 (4244kB)
0:11.472 [LOG] 36.85478 INFO juju.environs.sync listing available tools
0:11.472 [LOG] 36.85478 DEBUG juju.environs.tools reading v1.* tools
0:11.472 [LOG] 36.85478 DEBUG juju.environs.tools reading v1.* tools
0:11.472 [LOG] 36.85478 DEBUG juju.environs.tools found 1.15.0-raring-amd64
0:11.472 [LOG] 36.85478 INFO juju.environs.sync found 1 tools
0:11.472 [LOG] 36.85478 DEBUG juju.environs.sync found source tool: &{1.15.
0:11.472 [LOG] 36.85478 INFO juju.environs.sync listing target bucket
0:11.472 [LOG] 36.85478 DEBUG juju.environs.tools reading v1.* tools
0:11.472 [LOG] 36.85478 DEBUG juju.environs.tools reading v1.* tools
0:11.472 [LOG] 36.85478 INFO juju.environs.sync found 0 tools in target; 1 tools to be copied
0:11.472 [LOG] 36.85478 INFO juju.environs.sync copying 1.15.0-raring-amd64 from file://
0:11.472 [LOG] 36.85478 INFO juju.environs.sync copying tools/releases/
0:11.490 [LOG] 36.85478 INFO juju.environs.sync downloaded tools/releases/
0:11.490 [LOG] 36.85478 INFO juju.environs.sync download 4244kB, uploading
0:11.548 [LOG] 36.85478 INFO juju.environs.sync copied 1 tools
0:11.548 [LOG] 36.85478 INFO juju.environs.sync generating tools metadata
0:11.548 [LOG] 36.85478 DEBUG juju.environs.tools no architecture specified when finding tools, looking for any
0:11.548 [LOG] 36.85478 DEBUG juju.environs.tools no series specified when finding tools, looking for any
0:11.548 [LOG] 36.85478 DEBUG juju.environs.
0:11.548 [LOG] 36.85478 DEBUG juju.environs.
0:11.549 [LOG] 36.85478 INFO juju.environs.tools Writing tools/streams/
0:11.549 [LOG] 36.85478 INFO juju.environs.tools Writing tools/streams/
0:11.549 [LOG] 36.85478 INFO juju.environs.sync tools metadata written
0:11.551 /home/rog/
0:11.555 c.Assert(err, gc.IsNil)
0:11.555 ... value errors.
Changed in juju-core: | |
assignee: | nobody → Ian Booth (wallyworld) |
Changed in juju-core: | |
status: | New → Triaged |
importance: | Undecided → High |
tags: | added: test-failure |
tags: | added: gccgo |
There's a long story associated with this. The short answer is that this is pretty old code and there's a need for 2 possible tools prefixes because simplestreams uses a different location to where the tools used to go. Both still need to be supported for backwards compatibility. As soon as the tools repository is set up, the legacy code can be deleted, so it is only short term. The repository ticket was raised over a month ago so the code has had to stay around longer than anticipated.
The production code which uses the tools prefix is single threaded so there are no issues there. And it is only used in the case that simplestreams tools lookup fails or someone tries to sync tools where the tools are located in a deprecated directory.
The SetToolsPrefix method has been there a while and I think it may have been introduced specifically for live tests so as not to overwrite the real tools in ec2. This is just a guess as I didn't write it originally. But if tests are run across multiple processes, then it could cause issues.