capistrano / capistrano/capistrano

git stderr: fatal: cannot exec '/tmp/appname/git-ssh.sh': Text file busy

Open
#2,018 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
13k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

### Steps to reproduce
Can not possible to reproduce. It happens complete randomly (random time, random projects, random servers).
We use `capistrano` with Jenkins to deploy apps to servers.

### Expected behavior
```bash
15:44:49 00:00 git:wrapper
15:44:49 01 mkdir -p /tmp/appname/
15:44:49 ✔ 01 deployer@10.10.10.10 0.259s
15:44:49 Uploading /tmp/appname/git-ssh.sh 100.0%
15:44:49 02 chmod +rx /tmp/appname/git-ssh.sh
15:44:49 ✔ 02 deployer@10.10.10.10 0.048s
15:44:49 00:00 git:check
15:44:49 01 git ls-remote --heads git@github.com:orgname/projectname.git
```

### Actual behavior
```bash
13:33:31 00:00 git:wrapper
13:33:31 01 mkdir -p /tmp/appname/
13:33:31 ✔ 01 deployer@10.10.10.10 0.219s
13:33:31 Uploading /tmp/appname/git-ssh.sh 100.0%
13:33:31 00:00 git:check
13:33:31 01 git ls-remote --heads git@github.com:orgname/projectname.git
13:33:31 01 fatal: cannot exec '/tmp/appname/git-ssh.sh': Text file busy
13:33:31 01 fatal: unable to fork
13:33:31 (Backtrace restricted to imported tasks)
13:33:31 cap aborted!
13:33:31 SSHKit::Runner::ExecuteError: Exception while executing on host 10.10.10.10: git exit status: 128
13:33:31 git stdout: Nothing written
13:33:31 git stderr: fatal: cannot exec '/tmp/appname/git-ssh.sh': Text file busy
13:33:31 fatal: unable to fork
13:33:31
13:33:31
13:33:31 Caused by:
13:33:31 SSHKit::Command::Failed: git exit status: 128
13:33:31 git stdout: Nothing written
13:33:31 git stderr: fatal: cannot exec '/tmp/appname/git-ssh.sh': Text file busy
13:33:31 fatal: unable to fork
13:33:31
13:33:31 Tasks: TOP => git:check
13:33:31 (See full trace by running task with --trace)
```

### System configuration
cap \ doctor [link](https://gist.github.com/maidmantis/f5cf38c80a196baaa002bc4502ab283e
)
### Additional Info
Found solution for similar issue:
just add bash command `sync` on remote server right after uploading instruction. It flushes all IO buffer to HDD.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.