Reduce client log buffer from 4096 -> 0 - #302
Open
JiyuSoftware wants to merge 1 commit into
Open
JiyuSoftware wants to merge 1 commit into
JiyuSoftware wants to merge 1 commit into
Conversation
Member
|
Not sure if this might cause performance issues if something is spamming the logs, but having accurate log files in case of a crash is definitely important |
Author
|
I'm fairly certain that this does not performance issues at all. With a 4096 buffer you need to read every loop, which is only written once. This should make about performance equal in both scenarios. And besides that we're talking about the performance of a log writer. This code could probably output millions of lines of text per second while your CPU doesn't even break a sweat, far beyond the output of anything the game would ever output. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The stdout and stderr log are currently missing output at the end of every session because the FileStreams are created with a 4KB buffer. So everything that happens in the last 4KB of the log is always discarded and never written to the files.
A little background on how I found this bug:
I am writing a OBS stream overlay that should automatically switch scenes between lobby and gameplay. I tried to make my stream overlay work by parsing the log but it didn't work because the logs are currently not realtime, but in 4KB chunks. So it could take up to 2-4 minutes for the stream overlay to actually update based on the new 4KB chunk to be written to the log.
This rabbit hole goes deeper as well, because while working on this I also found that
PipeOutputnever properly closes the streams, which can cause other issues (separate PR here: #303)