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

Use fixed port in the logsever #71

Closed
luben opened this issue May 18, 2021 · 3 comments
Closed

Use fixed port in the logsever #71

luben opened this issue May 18, 2021 · 3 comments

Comments

@luben
Copy link

luben commented May 18, 2021

listener, err := net.Listen("tcp", host+":")

If log server starts listening on random port, and Lambda sandbox (function and extensions) is restarted, it can lose logs from the previous invocation or the log server could receive duplicate logs. Using a stable port in the same sandbox will guarantee exactly-once delivery of the logs. It also will reduce the memory utilization in the sandbox.

@kolanos
Copy link
Contributor

kolanos commented Jun 1, 2021

@luben Thanks for the heads up. Is this behavior documented anywhere? Also, are there any guidelines for port numbers to avoid conflicts with other extensions?

@luben
Copy link
Author

luben commented Jun 15, 2021

Hi, sorry I missed the question.

You can use any port != 9001. It's documented in https://docs.aws.amazon.com/lambda/latest/dg/runtimes-logs-api.html#runtimes-logs-api-dest

Though this may cause conflict with other extensions. May be try some static port and if the bind fails fall-back to random.

Unfortunately this behaviour around guarantees is not documented.

@kolanos
Copy link
Contributor

kolanos commented Jul 26, 2021

Static port added in #77.

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

No branches or pull requests

2 participants