Merge lp:~thumper/juju-core/fix-local-destroy into lp:~go-bot/juju-core/trunk

Proposed by Tim Penhey
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 2625
Proposed branch: lp:~thumper/juju-core/fix-local-destroy
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 18 lines (+8/-0)
1 file modified
provider/local/environ.go (+8/-0)
To merge this branch: bzr merge lp:~thumper/juju-core/fix-local-destroy
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+215601@code.launchpad.net

Commit message

Fix intermittent destroy error.

In order to manage the intermittent error that is returned
by os.RemoveAll if the directory is removed by another process
while it is trying, we double check before returning an error.

https://codereview.appspot.com/87500044/

Description of the change

Fix intermittent destroy error.

In order to manage the intermittent error that is returned
by os.RemoveAll if the directory is removed by another process
while it is trying, we double check before returning an error.

https://codereview.appspot.com/87500044/

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Reviewers: mp+215601_code.launchpad.net,

Message:
Please take a look.

Description:
Fix intermittent destroy error.

In order to manage the intermittent error that is returned
by os.RemoveAll if the directory is removed by another process
while it is trying, we double check before returning an error.

https://code.launchpad.net/~thumper/juju-core/fix-local-destroy/+merge/215601

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/87500044/

Affected files (+10, -0 lines):
   A [revision details]
   M provider/local/environ.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20140413170514-ii8w6q2fht3eiizi
+New revision: <email address hidden>

Index: provider/local/environ.go
=== modified file 'provider/local/environ.go'
--- provider/local/environ.go 2014-04-09 23:13:50 +0000
+++ provider/local/environ.go 2014-04-14 06:47:17 +0000
@@ -453,6 +453,14 @@

   // Finally, remove the data-dir.
   if err := os.RemoveAll(env.config.rootDir()); err != nil
&& !os.IsNotExist(err) {
+ // Before we return the error, just check to see if the directory is
+ // there. There is a race condition with the agent with the removing
+ // of the directory, and due to a bug
+ // (https://code.google.com/p/go/issues/detail?id=7776) the
+ // os.IsNotExist error isn't always returned.
+ if _, statErr := os.Stat(env.config.rootDir()); os.IsNotExist(statErr) {
+ return nil
+ }
    return err
   }
   return nil

Revision history for this message
Andrew Wilkins (axwalk) wrote :

On 2014/04/14 06:52:04, thumper wrote:
> Please take a look.

LGTM

https://codereview.appspot.com/87500044/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'provider/local/environ.go'
2--- provider/local/environ.go 2014-04-09 23:13:50 +0000
3+++ provider/local/environ.go 2014-04-14 06:50:03 +0000
4@@ -453,6 +453,14 @@
5
6 // Finally, remove the data-dir.
7 if err := os.RemoveAll(env.config.rootDir()); err != nil && !os.IsNotExist(err) {
8+ // Before we return the error, just check to see if the directory is
9+ // there. There is a race condition with the agent with the removing
10+ // of the directory, and due to a bug
11+ // (https://code.google.com/p/go/issues/detail?id=7776) the
12+ // os.IsNotExist error isn't always returned.
13+ if _, statErr := os.Stat(env.config.rootDir()); os.IsNotExist(statErr) {
14+ return nil
15+ }
16 return err
17 }
18 return nil

Subscribers

People subscribed via source and target branches

to status/vote changes: