-
Notifications
You must be signed in to change notification settings - Fork 41
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
Long running ESL connections unable to send commands #13
Comments
Hi @williamflynt, there are some really good comments in here, thanks for sharing them! There shouldn't be any 5 second context timeout so this seems like a potential bug. The only 5 second timeout in the library is related to not receiving a response while authorizing and can be overridden. Have you tried using an InboundOptions struct that potentially extends or disables that auth timeout? The In any case your suggestions are worth being looked into for improving things :) |
I haven't tried that. Here's where the deadline gets set on the first Line 124 in 6999297
I haven't looked into where deadline on the context originally comes from. |
The deadline gets set from the caller, in your code it would be the context passed in from here. if _, err := conn.SendCommand(ctx, command.API{
Command: "echo",
Arguments: log.Sprintf("ping %v", i),
Background: false,
}); However, internally to the library I am thinking that is what you are seeing here, the auth command not processing correctly. If raising the auth timeout to 10 seconds also keeps your commands running for 10 seconds we should be able to confirm if this theory is correct and proceed from there. Are you able to share a bit on how everything is configured for you? Are you doing ACL authentication for inbound ESL or running your program on the same machine as FS? Any verbose logs from FS showing the ESL command flow should help too. |
Some thoughts I have on the considerations outside of the 5 second disconnect issue.
|
I do potentially see an overlooked path where the onDisconnect handler may not be called. It wouldn't explain your 5 second disconnect issue though. |
Well - not sure. Have you tried the code I left to reproduce the bug? |
Problem
Bug Report
Connections made with
esl.Dial
cannot send commands usingc.SendCommand
after five seconds of life.This is because we set a global deadline on the connection.
I had a much longer issue written, with some additional data, but my machine inexplicably rebooted...
Content
Subjective Considerations #
I am grateful for this package! These are small things that can (maybe) be improved iteratively, and they are only my opinions.
context
docs -Do not store Contexts inside a struct type; instead, pass a Context explicitly to each function that needs it.
Conn
would be helpful for developers - specifically thenewConnection
constructor.receiveLoop
on acontext.Err()
with only an internallogger.Warn
can make it difficult to track down what's happening when things inevitably go wrong.panic
? I'm not normally a fan but the entire system is down at this point, right?error
.Conn
struct in favor of passing context around?Quick Workaround #
Disable the deadline checker/setter here (remove or comment out). Replace with another timeout enforcement method, or just allow the caller to manage their own timeouts.
Reproduce #
The text was updated successfully, but these errors were encountered: