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

Lifecycle detect go routine is no longer safe #510

Closed
jonfriesen opened this issue Jan 21, 2021 · 1 comment · Fixed by #511
Closed

Lifecycle detect go routine is no longer safe #510

jonfriesen opened this issue Jan 21, 2021 · 1 comment · Fixed by #511
Labels
status/triage type/bug Something isn't working

Comments

@jonfriesen
Copy link

jonfriesen commented Jan 21, 2021

Summary

It appears that with the latest version lifecycle a environment variable (CNB_BUILDPACK_DIR #325) is set to a different path at times when multiple processes (of detect) are running.

This is caused by the go routine in the detect stage that changes the pathing/envs within the DetectConfig.


Reproduction

Steps
  1. Have multiple source directories
  2. Run the detect binary against them in parallel
  3. Note the path in DetectConfig will be different
Current behavior

When running detect in parallel the buildpack detection files will mismatch as the go routine runs and overwrites packs that are taking longer than others. This causes paths within DetectConfig to be different than the contents of the detection.

For example, running detect against a large php app and nodejs app might end up with the path within the nodejs app as the one used for the php app.

Expected

The detector should be able to be run multiple times in parallel without effecting other detections.

We may want to mutex the entire DetectConfig file in the detector.go$detect(...) function though this might make the go routine useless.


Context

lifecycle version

v0.10.1

platform version(s)

v0.3

anything else?

I'm very new to this project but if will contribute a PR if we can track down a solid solution 🚀

@natalieparellano
Copy link
Member

Fixed by #511, released in v0.10.2

@jonfriesen @kamaln7 thank you again for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/triage type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants