ruby-git: Using one repo per thread results in errors
Lots of warning: conflicting chdir during another chdir block when I try to do anything with individual git objects.
I have multiple repos that I’ve opened using Git.open() and I can only operate on one at a time or else I get warnings
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 6
- Comments: 20 (10 by maintainers)
I’ll raise an issue to get rid of the chdirs. If #358 and #355 come along for free then that’s awesome 😃
On Sun, 1 Apr 2018, 14:16 Per Lundberg, notifications@github.com wrote:
Thank you for the update @xdmx!
I am working on an update that I think will fix this. I plan on running the git subprocess with Process.spawn instead of using backticks. This makes collecting the process output more difficult, but it has the following advantages:
I looked at less complex alternatives like those found in the Open3 module, but they didn’t offer flexibility currently used in this gem.
The one downside to this approach is that Process.spawn on JRuby is just different enough not to work in a few cases and I haven’t been able to figure out why. My approach is get a version working via MRI on Mac/Linux/Windows first and worry about JRuby later.
I hope to have something done by the end of the year (no promises – working in my free time). The changeset will have to touch a LOT of things so I will try to slow roll the update by having a patch release and major version bump.
For reference, discussion seems to be ongoing in https://github.com/ruby-git/ruby-git/pull/673#issuecomment-1782433049.
I’ve just got hit by this. I clone different repositories concurrently in Sidekiq jobs, when there is only one job running it works without any problem, but when there are 2+ jobs everything starts breaking down. Over the last 8 years there have been various attempts (#195, #372, #401, #383) to remove the use of
chdirand make this gem thread safe. Is there any chance that will be done? 🙏 /cc @jcouballIf not, it might be worth writing a “red big warning” in the readme to prevent others hitting this limit
@taquitos File a GitHub issue at https://github.com/probot/stale 😉 I pinned this issue for now.