Skip to content

srs 2.0 logrotate copytruncate generates file holes #1554

@fastfading

Description

@fastfading

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

Metadata

Metadata

Assignees

Labels

TransByAITranslated by AI/GPT.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions