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

Will this code in server.py mess the log? #691

Open
kramerli opened this issue Dec 25, 2017 · 1 comment
Open

Will this code in server.py mess the log? #691

kramerli opened this issue Dec 25, 2017 · 1 comment

Comments

@kramerli
Copy link

I can see below code in server.py

    handlers_process = multiprocessing.Process(
        name="Handlers",
        target=handler_process,
        args=(self.handlers, self.metric_queue, self.log),
    )

I did some search on the internet, a lot posts said that logging do not have a lock between process. So use log in multiprocessing may cause the content of log be messed.

Will this code have this kind of problem?
If not then why?

@DStape
Copy link
Contributor

DStape commented Mar 21, 2018

Hi @kramerli,

This is a good question. Writing to the same file from different processes can result in weird behaviour - the data written might be interleaved and/or incomplete, or worse, the file may become corrupted. I think there will be other factors in play though, for example what type of file system is in use.

I think this is something that will have to be investigated further and fixed.

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

No branches or pull requests

2 participants