Skip to content

Conversation

@TimKingtonFC
Copy link
Collaborator

@TimKingtonFC TimKingtonFC commented Aug 6, 2020

This is based on howbazaar's changes with 4a6f656c's comments here: https://github.com/natefinch/lumberjack/pull/100/files
I changed a few things, too.


import (
"os"
"sync"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What's the easiest way to test the linux version?

Choose a reason for hiding this comment

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

add a build tag for only running on linux (if necessary), then run on a linux machine (e.g. Jenkins)


// we need to wait a little bit since the files get deleted on a different
// goroutine.
<-time.After(10 * time.Millisecond)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was waiting for something that shouldn't happen. Now we'll get a deadlock in the test is there's an extra remove because nobody reads the notifyRemove chan.


// we need to wait a little bit since the files get deleted on a different
// goroutine.
<-time.After(10 * time.Millisecond)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ditto

fileCount(dir, 2, t)
newFakeTime()

b2 := []byte("bar")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added data so we can see if the files are rotated correctly.

defer l.mu.Unlock()

if l.millCh != nil {
close(l.millCh)
Copy link

Choose a reason for hiding this comment

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

this is the actual fix for the leak, right? (just making sure I grok it)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes

@connyay
Copy link

connyay commented Aug 6, 2020

Is this based on natefinch#100 ?

@TimKingtonFC
Copy link
Collaborator Author

Is this based on natefinch#100 ?

Yep. Added that to the description, but you were too fast for me.


import (
"os"
"sync"

Choose a reason for hiding this comment

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

add a build tag for only running on linux (if necessary), then run on a linux machine (e.g. Jenkins)

Copy link

@connyay connyay left a comment

Choose a reason for hiding this comment

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

Nice!

@connyay
Copy link

connyay commented Aug 10, 2020

@TimKingtonFC this good to land?

@TimKingtonFC
Copy link
Collaborator Author

Yes, but I haven't figured out how to run the linux tests.

@TimKingtonFC TimKingtonFC merged commit 1b9897e into v2.0 Aug 10, 2020
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.

4 participants