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
pyenv shims fail with concurrent processes in a build system #174
Comments
Yep, there is race condition in I'm not sure if this is worth for your situation, the Jenkins' plugin of pyenv is providing lock mechanism based on https://github.com/jenkinsci/pyenv-plugin/blob/master/lib/pyenv/semaphore.rb |
So i have successfully worked around the problem by using the jenkins pyenv plugin to but it seems this plugin doesn't install all of the extra helpers that pyenv-installer does, as it fails in a later build step when i'm calling: it says that i need to restart my shell as the virtualenv plugin is not installed properly. Its confusing because the preceding step worked: Is there a way to get the jenkins pyenv plugin to install all of the extra helpers that pyenv-installer does? |
Unfortunately, there is no way to install extra pyenv plugins via Jenkins pyenv plugin for now. Please write job script to do special tasks. |
So it seems with the jenkins pyenv plugin i still get the concurrency issues but less often? I can move the discussion over to that repo if you'd like but here is the console output from jenkins when the failure happens Fetching changes from 1 remote Git repository |
pyenv is not process safe for now. Please use external lock mechanism (e.g. like jenkins-pyenv-plugin is doing) to avoid race conditions. |
Where is the issue tracker for the jenkins-pyenv-plugin? (As it looks like it may remove the lock directory, even if it did not manage to create it.) |
There appears to be a race condition if there is a pyenv installation on a build machine that runs multiple processes which create virtualenv's via the command :
pyenv virtualenv name of env
When there are two concurrently running processes that try to create a virtualenv for each process there is a race condition when the second process runs the command to create a new virtualenv it eventually makes a call to rehash and errors because of:
pyenv: cannot rehash: /var/lib/jenkins/.pyenv/shims/.pyenv-shim exists
I fully understand if this is a limitation of the way pyenv shims work, but i'm wondering if there is a workaround for this. Since shim's are path based and each process can have its own environment variables, it would be nice if each process could specify a location for its set of shims so multiple processes on the same machine using pyenv won't collide when the shims are rehashed.
I would think something much like the PYENV_ROOT env var. It could be PYENV_SHIM_ROOT env var that tells pyenv where to place the shims and if not specified it could default to the standard location.
Let me know if there is anyway i can help make this a reality.
The text was updated successfully, but these errors were encountered: