Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

if config.CleanWindow > 0 {
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.