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

Fix log streaming missing frames #11721

Merged
merged 15 commits into from
Jan 4, 2022

Conversation

arkadiuss
Copy link
Contributor

Hi,

this MR aims to address the issue reported here #11653 . I described the problem in this comment.

This solution adds one more channel to the streamFile function that instead of cancelling on the event from channel when eof is reached, it performs one more read until eof which I think should be an expected behavior while streaming logs.

It is a draft for now opened for discussion. I confirmed that it works for the example posted in the issue. It should work since while newFileEvent is generated, the previous file is already full.

I haven't checked tests yet.

@hashicorp-cla
Copy link

hashicorp-cla commented Dec 21, 2021

CLA assistant check
All committers have signed the CLA.

@tgross tgross self-requested a review December 22, 2021 14:54
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @arkadiuss and thanks for this PR! I see where you're going with this but I've left some remarks about the previous channel that we got from blockUntilNextLog and what we're doing with it.

client/fs_endpoint.go Outdated Show resolved Hide resolved
client/fs_endpoint.go Outdated Show resolved Hide resolved
@arkadiuss
Copy link
Contributor Author

I wanted to cover this scenario in tests. It was hard to create deterministic test since we don't know which event will come first, but I modfied the existing test in a way that the old code (without fix) fails it in most of the cases.

client/fs_endpoint.go Outdated Show resolved Hide resolved
client/fs_endpoint.go Show resolved Hide resolved
client/fs_endpoint.go Outdated Show resolved Hide resolved
client/fs_endpoint.go Show resolved Hide resolved
Co-authored-by: Tim Gross <tgross@hashicorp.com>
@vercel vercel bot temporarily deployed to Preview – nomad January 3, 2022 16:49 Inactive
@tgross
Copy link
Member

tgross commented Jan 4, 2022

@arkadiuss if you'd like to add a changelog bugfix entry that'd be appreciated. Create a file at .changelog/11721.txt that looks something like this. With language something like:

client: Fixed a bug where the allocation log streaming API was missing log lines that spanned log file rotation

@arkadiuss
Copy link
Contributor Author

@arkadiuss if you'd like to add a changelog bugfix entry that'd be appreciated. Create a file at .changelog/11721.txt that looks something like this. With language something like:

client: Fixed a bug where the allocation log streaming API was missing log lines that spanned log file rotation

Thanks, it's added

@tgross tgross added this to the 1.2.4 milestone Jan 4, 2022
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the PR @arkadiuss and thanks for sticking with it through a tricky review! This will ship in the next scheduled release of Nomad.

@tgross tgross merged commit aa21628 into hashicorp:main Jan 4, 2022
@arkadiuss
Copy link
Contributor Author

LGTM! Thanks for the PR @arkadiuss and thanks for sticking with it through a tricky review! This will ship in the next scheduled release of Nomad.

Awesome! It was great experience to work with you on it. Thank you for this, in-depth questions and quick responses!

@github-actions
Copy link

github-actions bot commented Nov 5, 2022

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants