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

tunnel_check_sleep behavior is not straightforward #42

Open
sashasimkin opened this issue Sep 4, 2024 · 0 comments
Open

tunnel_check_sleep behavior is not straightforward #42

sashasimkin opened this issue Sep 4, 2024 · 0 comments

Comments

@sashasimkin
Copy link

Hi!

While using this module with SSM gateway on a slow connection I had intermittent "Connection refused" errors, while sometimes it did work, when the speed of internet worsened it completely blocked my terraform applys.

While reading the inputs to the module, I saw tunnel_check_sleep, that could help in my situation, however when I set it to 5, then 10, then 30 seconds nothing changed in the terraform logs, no longer delay and I was getting same "Connection refused" errors.
The weird thing here was that it was still taking 3 seconds to "read" the data.external.ssh_tunnel resource.

After that, I tried setting parent_wait_sleep to a bigger value (10), and errors went away, and I also saw that now it took 10 seconds to retrieve data.external.ssh_tunnel.

When I went to the source code I saw the logic of parent/child tunnel initiation, and specifically that this is how actual tunnel is established:

nohup timeout "$TUNNEL_TIMEOUT" "$TUNNEL_SHELL_CMD" "$TUNNEL_ABSPATH/tunnel.sh" "$p" <&- >&- 2>"$clog" &

which means that it's running in the background still, but also, terraform doesn't wait for childs to return control back to the other resources.

While writing this and looking at the code I just realized that the parent_wait_sleep should be > tunnel_check_sleep for the encoded logic to work.
From the documentation, however it reads that they're additive and not overlapping.

I'm not sure if this is something that you would consider as worth to fix, but I think it makes sense to document more the relation of these two variables.

@sashasimkin sashasimkin changed the title tunnel_check_sleep does nothing tunnel_check_sleep behavior is not straightforward Sep 4, 2024
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

1 participant