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

[BUG] race condition in debug/log/os.go #1071

Closed
vtolstov opened this issue Dec 30, 2019 · 2 comments
Closed

[BUG] race condition in debug/log/os.go #1071

vtolstov opened this issue Dec 30, 2019 · 2 comments
Labels

Comments

@vtolstov
Copy link
Contributor

logger tries to replace os.Stderr and os.Stdout, this is impossible to protect with mutex, because this is standard way for most of packages to write messages (via fmt or log or directly call write to this variables).

So i want to suggest to remove replacing in run() func that global variables. Also i'm found discussion in go issue about this golang/go#13473

One possible solution to do replacing is use guard process/forking. So some loader open fd for stderr stdout, fork process with stdout stderr and do logging. But for most cases this is not so good (but go uses something like this in case of syscall.Dup2 not supported by os)

Main issue with current approach - race detector always says about race conditions when we do

*os.Stdout = *w1
*os.Stderr = *w2
.....
*os.Stdout = stdout
*os.Stderr = stderr
@vtolstov vtolstov added the bug label Feb 5, 2020
@vtolstov
Copy link
Contributor Author

vtolstov commented Feb 5, 2020

needs to be done after logger

@vtolstov
Copy link
Contributor Author

fixed in last release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant