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

srs 2.0 logrotate copytruncate generates file holes #1554

Closed
fastfading opened this issue Jan 4, 2020 · 2 comments
Closed

srs 2.0 logrotate copytruncate generates file holes #1554

fastfading opened this issue Jan 4, 2020 · 2 comments
Assignees
Labels
TransByAI Translated by AI/GPT.
Milestone

Comments

@fastfading
Copy link

fastfading commented Jan 4, 2020

Description'

Please ensure that the markdown structure is maintained.

Describe the problem you encountered here:
srs 2.0 logrotate copytruncate generates file holes

  1. SRS version: 2.0
  2. SRS log is as follows:
    Please make sure to maintain the markdown structure.
\0\0\0 ....
normal log

Reproduction (Replay)

Please make sure to maintain the markdown structure.

Configure copy truncate in logrotate
When rotate is executed, the next file will have holes.

Refer to fix

d = ::open(filename.c_str(), O_RDWR | O_APPEND); 
if(fd == -1 && errno == ENOENT) { 
fd = open(filename.c_str(), 
O_RDWR | O_CREAT | O_TRUNC | O_APPEND/*logrotate copytruncate need this flag*/, 
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH 
); 
}

refer
https://blog.csdn.net/caomiao2006/article/details/12752359
Expected Behavior
The log file should not have any gaps.

TRANS_BY_GPT3

wnpllrzodiac pushed a commit to wnpllrzodiac/srs that referenced this issue Jan 6, 2020
winlinvip pushed a commit that referenced this issue Jan 8, 2020
* fix logrotate empty file hole issue
refer to #1554
@limjoe
Copy link

limjoe commented Jul 2, 2020

I deployed version 3.0 of k8s cluster, and on one of the host machines, I used the copytruncate method to rotate logs. However, I encountered the issue of sparse files. Is it possible that version 3.0 release 0 does not support the copytruncate method yet, and currently only version 2.0 supports it?

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Sep 5, 2021
@winlinvip winlinvip added this to the 3.0 milestone Sep 6, 2021
@winlinvip winlinvip changed the title srs 2.0 logrotate copytruncate 产生文件空洞 srs 2.0 logrotate copytruncate generates file holes Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

3 participants