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

loggerd: fixed the message queue growing infinitely when the incoming encoders less than max_waiting. #27515

Closed
wants to merge 1 commit into from

Conversation

deanlee
Copy link
Contributor

@deanlee deanlee commented Mar 7, 2023

Issue: offset_segment_num > s->rotate_segment will be always true if the incoming encoder types less than the max_waiting:

} else if (offset_segment_num > s->rotate_segment) {
// encoderd packet has a newer segment, this means encoderd has rolled over
if (!re.marked_ready_to_rotate) {
re.marked_ready_to_rotate = true;
++s->ready_to_rotate;
LOGD("rotate %d -> %d ready %d/%d for %s",
s->rotate_segment.load(), offset_segment_num,
s->ready_to_rotate.load(), s->max_waiting, name.c_str());
}
// queue up all the new segment messages, they go in after the rotate
re.q.push_back(msg);

Set the max_waiting according to the incoming encoders to fix this issue, resolve #27512

@deanlee deanlee marked this pull request as ready for review March 7, 2023 14:39
@bleufa
Copy link

bleufa commented Mar 7, 2023

idk if this fixes the issue, I can still see the memory usage increasing in top

@deanlee deanlee marked this pull request as draft March 7, 2023 18:19
@deanlee
Copy link
Contributor Author

deanlee commented Mar 7, 2023

it's lgtm:

==440055== LEAK SUMMARY:
==440055== definitely lost: 0 bytes in 0 blocks
==440055== indirectly lost: 0 bytes in 0 blocks

have you started encoderd before loggerd?

@bleufa
Copy link

bleufa commented Mar 7, 2023

i'm not running encoderd at all, just in offroad I can see the memory usage increasing after running for a few minutes. also see possibly lost bytes in valgrind

@bleufa
Copy link

bleufa commented Mar 7, 2023

can you see the memory usage increasing?

@deanlee
Copy link
Contributor Author

deanlee commented Mar 8, 2023

Not yet. I can't see any place where memory leaks may occur If the encoderd is not running.

@deanlee deanlee closed this Jun 25, 2023
@deanlee deanlee deleted the loggerd_fix_memoryleak branch June 25, 2023 23:41
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

Successfully merging this pull request may close these issues.

PC: loggerd memory leak
2 participants