Skip to content
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

only report tasklogger is running if both stdout and stderr are still running #8155

Merged
merged 2 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ BUG FIXES:
* api: Fixed a bug where setting connect sidecar task resources could fail [[GH-7993](https://github.com/hashicorp/nomad/issues/7993)]
* client: Fixed a bug where artifact downloads failed on redirects [[GH-7854](https://github.com/hashicorp/nomad/issues/7854)]
* csi: Validate empty volume arguments in API. [[GH-8027](https://github.com/hashicorp/nomad/issues/8027)]
* client: Fixed a bug where stdout/stderr were not properly reopened for
community task drivers. [[GH-8155](https://github.com/hashicorp/nomad/issues/8155)]

## 0.11.2 (May 14, 2020)

Expand Down
10 changes: 3 additions & 7 deletions client/logmon/logmon.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,10 @@ type TaskLogger struct {

// IsRunning will return true as long as one rotator wrapper is still running
func (tl *TaskLogger) IsRunning() bool {
if tl.lro != nil && tl.lro.isRunning() {
return true
}
if tl.lre != nil && tl.lre.isRunning() {
return true
}
lroRunning := tl.lro != nil && tl.lro.isRunning()
lreRunning := tl.lre != nil && tl.lre.isRunning()

return false
return lroRunning && lreRunning
}

func (tl *TaskLogger) Close() {
Expand Down
4 changes: 2 additions & 2 deletions client/logmon/logmon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ func TestLogmon_Start_restart(t *testing.T) {
})
require.True(impl.tl.IsRunning())

// Close stdout and assert that logmon no longer writes to the file
require.NoError(stdout.Close())
// Close stderr and assert that logmon no longer writes to the file
// Keep stdout open to ensure that IsRunning requires both
require.NoError(stderr.Close())

testutil.WaitForResult(func() (bool, error) {
Expand Down