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: Multiprocess cannot write log to the same file #1056

Closed
nguyenhoangthuan99 opened this issue Aug 30, 2024 · 3 comments · Fixed by #1173
Closed

bug: Multiprocess cannot write log to the same file #1056

nguyenhoangthuan99 opened this issue Aug 30, 2024 · 3 comments · Fixed by #1173
Assignees
Labels
category: app shell Installer, updaters, distributions P1: important Important feature / fix type: bug Something isn't working

Comments

@nguyenhoangthuan99
Copy link
Contributor

nguyenhoangthuan99 commented Aug 30, 2024

Problem
In windows, once a file is taken by one process, other process can not modify it. For example, when the server is writing to log file, it hold cortex.log, and if we run CLI command, it cannot write message to cortex.log.

Solution
In window, we are planning to use Unix Domain Socket to start a thread and write log to file. Below are detail implementation:

  • When start server, will create a thread to run UDS to listen messages and write to logfile.
  • From server side, override log method of Trantor to send log message to UDS server
  • From CLI side, when execute command, check if UDS server is live, if not write directly log to log file.
  • With command has --verbose flag, log everything to terminal.
@nguyenhoangthuan99 nguyenhoangthuan99 added the type: bug Something isn't working label Aug 30, 2024
@imtuyethan imtuyethan transferred this issue from janhq/jan Aug 30, 2024
@nguyenhoangthuan99
Copy link
Contributor Author

For windows, we are planning to use Unix Domain Socket to communicate between process, only one process will write to log file

@nguyenhoangthuan99 nguyenhoangthuan99 linked a pull request Sep 6, 2024 that will close this issue
@freelerobot freelerobot changed the title Multiprocess cannot write log to the same file bug: Multiprocess cannot write log to the same file Sep 6, 2024
@freelerobot freelerobot added P0: critical Mission critical P1: important Important feature / fix and removed P0: critical Mission critical labels Sep 6, 2024
@dan-menlo dan-menlo added the category: app shell Installer, updaters, distributions label Sep 6, 2024
@dan-menlo
Copy link
Contributor

@nguyenhoangthuan99 Question from my side - did we consider having a separate log for CLI and Server?

@nguyenhoangthuan99
Copy link
Contributor Author

we will separate log for CLI and server, details in this comment

@nguyenhoangthuan99 nguyenhoangthuan99 linked a pull request Sep 9, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from In Progress to Completed in Menlo Sep 10, 2024
@nguyenhoangthuan99 nguyenhoangthuan99 moved this from Completed to QA in Menlo Sep 19, 2024
@freelerobot freelerobot moved this from QA to Completed in Menlo Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: app shell Installer, updaters, distributions P1: important Important feature / fix type: bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants