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

Stop printing message when doing a context shutdown #374

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rubenv
Copy link

@rubenv rubenv commented Sep 11, 2023

Uses the configured logger instead.

@cristaloleg
Copy link
Collaborator

Good catch, thanks!

@cristaloleg
Copy link
Collaborator

@rubenv
Copy link
Author

rubenv commented Sep 11, 2023

I honestly have no idea why it would cause that.

@cristaloleg
Copy link
Collaborator

AFAIR it's because during a test run os.Stdout is replaced with a test-specific writer to catch the full output. And because this we're logging in a goroutine we can log after a test end, which results in a panic due to Go test cleanup.

If you're curious to fix it than try to replace this context with context.WithCancel(...)

cache, initErr := bigcache.New(context.Background(), config)

And if you're not curious (which is fine too) I will take a look later today (leaving PR open for some time).

Thanks.

Comment on lines 102 to +103
go func() {
logger := newLogger(config.Logger)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will solve the data race

Suggested change
go func() {
logger := newLogger(config.Logger)
logger := newLogger(config.Logger)
go func() {

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! anyway, replacing ctx is also a good thing for the future.

@janisz
Copy link
Collaborator

janisz commented Nov 2, 2023

@rubenv Ping

@janisz janisz added the bug label Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants