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

Races in the PackagedFunctionRunner #5661

Closed
negz opened this issue May 9, 2024 · 0 comments · Fixed by #5662
Closed

Races in the PackagedFunctionRunner #5661

negz opened this issue May 9, 2024 · 0 comments · Fixed by #5662
Assignees
Labels
bug Something isn't working composition functions
Milestone

Comments

@negz
Copy link
Member

negz commented May 9, 2024

What happened?

While fixing some racy locking code in #5651 I realized I used a similar anti-pattern in the composition function PackagedFunctionRunner. There's a couple of places where that code:

  1. Takes the read lock, reads some state, and releases the read lock
  2. Computes something based on the read state
  3. Takes the write lock, updates the state, and releases the write lock

The risk is that another Goroutine takes the write lock between when we release our read lock and take our write lock, thus invalidating the computed state we write back.

How can we reproduce it?

I guess run a lot of functions.

What environment did it happen in?

Crossplane version:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working composition functions
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants