-
Notifications
You must be signed in to change notification settings - Fork 31
fix: forward logs directly when invocation is over #613
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
base: main
Are you sure you want to change the base?
Conversation
do not send to the lambda data chan and potentially wait forever causing a timeout on shutdown
Can you describe the issue in the PR description and how this PR solves it? |
Co-authored-by: Tim Rühsen <tim.ruhsen@elastic.co>
Updated! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add tests, or is that too unpredictable?
Thanks! Maybe I misunderstand the code changes, but it looks to me that you replace direct writes to the channel with a function that writes to the data channel. How is that a difference in the data flow logic and don't we still have the same issue then (channel reader doesn't read any more)? I somewhat agree with @dmathieu that we should try to create a test that reproduces the issue, and then prove that this code solves the issue. It doesn't have to be a unit test, if that is too involved. Maybe some kind of tool / setup / script, whatever is the simplest way. |
just nudging here in case it gets forgotten because the related SDH was auto-closed |
There are three places that have been updated. The first two are directly forwarding the data bypassing the channel, the last one is unchanged and just send to a channel.
maybe we can reuse the setup from @xrmx ? I'm not sure how feasible it is to write a unit test for this. |
Thanks for the explanation.
@xrmx Can you run your reproducer again with the changes here and confirm that it fixes the issue? |
The lambda extension process data in the background during an invocation:
apm-aws-lambda/app/run.go
Lines 197 to 204 in 3f5620c
Data is sent to a channel. This is fine during an invocation when the goroutine is running but it's possible that during shutdown the channel will block because there's no goroutine running.
apm-aws-lambda/app/run.go
Line 101 in 3f5620c
The solution is to bypass the channel and forward the data directly during shutdown.