teleport icon indicating copy to clipboard operation
teleport copied to clipboard

Fix race condition to sessions map in K8S proxy

Open xacrimon opened this issue 2 years ago • 2 comments

This PR fixes some unguarded accesses to the sessions map on the K8S proxy service.

xacrimon avatar Aug 05 '22 11:08 xacrimon

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 avatar Aug 05 '22 16:08 zmb3

@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.

xacrimon avatar Aug 08 '22 19:08 xacrimon

@xacrimon See the table below for backport results.

Branch Result
branch/v10 Create PR
branch/v9 Create PR

github-actions[bot] avatar Aug 11 '22 23:08 github-actions[bot]