git-extras icon indicating copy to clipboard operation
git-extras copied to clipboard

git-effort:fork: retry: Resource temporarily unavailable

Open Lonenso opened this issue 3 years ago • 3 comments

I just heard git-extras this powerful tool, and try to use git effort and encounter this error.

❯ ulimit -a
-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8192
-c: core file size (blocks)         0
-v: address space (kbytes)          unlimited
-l: locked-in-memory size (kbytes)  unlimited
-u: processes                       2784
-n: file descriptors                65535

❯ launchctl limit
	cpu         unlimited      unlimited
	filesize    unlimited      unlimited
	data        unlimited      unlimited
	stack       8388608        67104768
	core        0              unlimited
	rss         unlimited      unlimited
	memlock     unlimited      unlimited
	maxproc     2784           4176
	maxfiles    65535          65535

macOS Monterey: 12.3.1, intel git-extra: 6.4.0

since I'm using this command on a private repo, I find another repo to reproduce this.

I'm happy to provide more details if you guys need.

Lonenso avatar May 31 '22 05:05 Lonenso

maxproc     2784           4176

I guess it is because the number of processes is not enough, as currently git effort will create a background process per path.

spacewander avatar May 31 '22 06:05 spacewander

Yeah, so I wonder if we can limit the processes.

nProcs=12 # hardcode, can be replaced to nproc --all
nJobs="\j"
for ((i=0; i<nPaths; ++i))
do
    while (( ${nJobs@P} >= nProcs )); do
        wait -n
    done
    effort "${paths[i]}" &
done|tee $tmp

This works for me. The approach comes from https://stackoverflow.com/a/38775799/9482854

Lonenso avatar Jun 01 '22 09:06 Lonenso

PR is welcome!

spacewander avatar Jun 02 '22 06:06 spacewander

since the PR is merged, close this issue.

Lonenso avatar Sep 29 '22 05:09 Lonenso