New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix for a bug #2226 #2231
fix for a bug #2226 #2231
Conversation
Signed-off-by: Brad Koehn <brad@koehn.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick PR!
I made a couple of minor comments.
Considering you are able to get a consistent repro of this, would you be willing to run a test image of Velero with this fix in your environment to confirm that the problem is fully fixed?
Signed-off-by: Brad Koehn <brad@koehn.com>
I made some of the changes you mentioned and commented on the others. I'm happy to run it for testing; how do I build an image? |
OK, it looks like |
Building a container image is not very friendly atm. Once you've pushed all your changes I can build a container and share it with you. That may be faster. lmk.. |
…f statement Signed-off-by: Brad Koehn <brad@koehn.com>
Signed-off-by: Brad Koehn <brad@koehn.com>
This reverts commit 39a5751. Signed-off-by: Brad Koehn <brad@koehn.com>
Signed-off-by: Brad Koehn <brad@koehn.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Let me get you a container image with these changes that you can run :)
Signed-off-by: Brad Koehn <brad@koehn.com>
Signed-off-by: Brad Koehn <brad@koehn.com>
@koehn you should be able to pull this image to test.
If you are unable to pull that image for any reason, you can make a local change similar to #2233 and build your container image like
Then you can use |
One more fix I uncovered in testing. |
Thanks I was able to build and test it myself. It works fine; just added a change to avoid decoding a line w/o and JSON and logging an error. |
LGTM so far. I'll take a closer look tomorrow! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT.
Please let us know if you would like me to build you a container image for testing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two minor comments mainly for your own edification, not merge-blocking. LGTM. Thanks for the PR!
TotalBytes: stat.TotalBytes, | ||
BytesDone: stat.BytesDone, | ||
}) | ||
if len(lastLine) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd be more consistent with go style to invert this, so e.g.
if len(lastLine) == 0 {
break
}
...
so the main logic can be less indented. this is not a merge-blocking comment, though.
@@ -153,6 +155,9 @@ func decodeBackupStatusLine(lastLine []byte) (backupStatusLine, error) { | |||
// have a newline at the end of it, so this returns the substring between the | |||
// last two newlines. | |||
func getLastLine(b []byte) []byte { | |||
if b == nil || len(b) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should be able to just do if len(b) == 0 {
since a nil slice also has a length of zero. Not blocking.
This fixes a race condition that happens when velero looks at restic's stdout before it has output any lines. The bug (an array index out of bounds) causes velero to crash, which takes out the entire container including restic, which causes restic to fail to run its backup.
The fix checks for null or empty strings and handles them correctly. There are tests to make sure.
closes #2226