-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix panic for Eventually functions #808
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine for me, thanks for that 😄
I believe we should also consider limiting the number of Let me know what you think. |
I am wondering if it is worth re-implementing this using a pipeline pattern as described on the Go Blog. I figure it gives us the concurrency safety we are missing in the master implementation as well as defines some components for other concurrent matchers that may come along. I spiked an example: https://play.golang.org/p/qJcXUfgnmgA |
Can we consider the above suggestion? |
I am not against using pipeline pattern, because I use it a lot in my daily work. However, in my personal opinion, we should settle for something smaller and tailored specifically for the job. We could achieve the same by just disabling the ticker channel like this: https://play.golang.org/p/GhfafyX9epo |
I think there might be a bug in this PR.
jumps to the (I came across this PR because I ran into the issue #805) |
It's true, but without it you risk go routine leaks, these are tests, but still... We could increase the buffer, but to what end It seems that we did not decide what the final approach should be yet. Like I mentioned in previous comments, in my opinion we should not be calling |
Since you're no longer closing the |
@georgelesica-wf I updated the code with the approach that I proposed above. Tests are failing on Go tip, it's a go mod related failure unrelated to this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience!
stretchr/testify#808 is merged into master, but not yet released as of moment of writing. Updating to latest master version.
stretchr/testify#808 is merged into master, but not yet released as of moment of writing. Updating to latest master version.
stretchr/testify#808 is merged into master, but not yet released as of moment of writing. Updating to latest master version.
`TestBuildsHelperCollect` panics from time to time for example https://gitlab.com/gitlab-org/gitlab-runner/-/jobs/769151804 because, we are using [`Eventually`](https://gitlab.com/gitlab-org/gitlab-runner/-/blob/2cf2f6eb9ab23d3445dd5297ff539bf571a614fb/vendor/github.com/stretchr/testify/assert/assertions.go#L1473-1498) and there is a bug where it [tries to write to a channel](https://gitlab.com/gitlab-org/gitlab-runner/-/blob/2cf2f6eb9ab23d3445dd5297ff539bf571a614fb/vendor/github.com/stretchr/testify/assert/assertions.go#L1494) that is closed by a [defer](https://gitlab.com/gitlab-org/gitlab-runner/-/blob/2cf2f6eb9ab23d3445dd5297ff539bf571a614fb/vendor/github.com/stretchr/testify/assert/assertions.go#L1483). Since the write is in it's own goroutine it can be the case that the goroutine is schedule **after** the function returns which closes the channel. Newer version of testify aren't effected by this because [`Eventually`](https://github.com/stretchr/testify/blob/54d05a4e18440fb0a44989ab910f347eac4a131f/assert/assertions.go#L1635-L1662) was re-written and fixed in stretchr/testify#808. closes https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27037
Fixes #805
Fixes #835
/cc @gmiejski @georgelesica-wf