teleport
teleport copied to clipboard
Fix race condition to sessions map in K8S proxy
This PR fixes some unguarded accesses to the sessions map on the K8S proxy service.
Can you add a test that trips the race detector before this change and runs correctly with the change applied? I don't like the idea of a random race condition that there wasn't an issue filed for and that our tests didn't catch.
@zmb3 I mean I tested this and checked every access to the map using the find-references vscode tool. I don't think we have test infrastructure set up for running high concurrent tests with a race detector on in the hopes of tripping it. Moreover I am not sure this is a good idea since race conditions like this can be hard and nondeterministic to catch even with a race detector, the only real solution being to busyloop the test and hope it triggers. That'd screw up our CI times pretty good and won't help us get any closer to a fast feedback loop. If you have suggestions for testing race conditions deterministically I'd be happy to write it though, just not sure that we have a good way to do it.