flakytest: cache channels closer - #4242
Closed
MustafaSaber wants to merge 1 commit into
Closed
Conversation
In some tests where we use synctest we create the filter outside becuase we don't care about values in channels and the time. However, in go chan is attributed to a bubble (synctest) or not in creation time and ctx.Done() channel is only created after the first call to ctx.Done() (lazy loading). So we can have a race where revalidationWorker already started and ran `s.ctx.Done()` or enqueueRevalidation which run inside the bubble. I the first case the chan will be attributed to no bubble so we can close from outside synctest but in the second case chan will be attributed to the bubble so we can't close from outside. Using `_ := ctx.Done()` in main code will force the chan to be always attributed to the routing creating the filter (force loading) This shows the fix but I think we should't merge because it has no effects outside tests and we can just init all tests inside synctest so it doesn't make sense to change main code to fix the test in this case Signed-off-by: Mustafa Abdelrahman <mustafa.abdelrahman@zalando.de>
|
Docker image "registry-write.opensource.zalan.do/teapot/skipper:83f6a9ec20bf568f4dde8619b781b1a8c0ad76ec" is not based on an approved base image. Any production deployment relying on this image will be blocked. To create a compliant Docker image of your application, you must reference an allowed Docker image as its base image in your Dockerfile. This base image must come from the Zalando Container Registry namespace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In some tests where we use synctest we create the filter outside becuase we don't care about values in channels and the time. However, in go, chan is attributed to a bubble (synctest) or not in creation time and ctx.Done() channel is only created after the first call to ctx.Done() (lazy loading). So we can have a race where revalidationWorker already started and ran
s.ctx.Done()or enqueueRevalidation which run inside the bubble. I the first case the chan will be attributed to no bubble so we can close from outside synctest but in the second case chan will be attributed to the bubble so we can't close from outside.Using
_ := ctx.Done()in main code will force the chan to be always attributed to the routing creating the filter (force loading)This shows the fix but I think we should't merge because it has no effects outside tests and we can just init all tests inside synctest so it doesn't make sense to change main code to fix the test in this case
The error can be reproduced by:
see #4241