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

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

Open
maidmantis opened this issue May 21, 2019 · 3 comments
Open

Comments

@maidmantis
Copy link

maidmantis commented May 21, 2019

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

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

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 <stage> doctor link

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.

@leehambley
Copy link
Member

Any information you can provide about your OS environment/etc please?

@maidmantis
Copy link
Author

Any information you can provide about your OS environment/etc please?

Hi @leehambley ,
Thanks for response.
All apps are running on AWS EC2 instances (types: t2.micro, t2.medium, m4.large, c5.large and EBSes gp2).
Following info is equal for all instances.

OS: Ubuntu 16.04.1 LTS
Kernel: Linux 10-10-10-10.internal 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
SSHD: OpenSSH_7.2p2 Ubuntu-4ubuntu2.8, OpenSSL 1.0.2g  1 Mar 2016

Best wishes

@will-in-wi
Copy link
Contributor

Any chance you are doing multiple deploys to the same server? This sounds like a race condition where they are both contending for the same file.

Somewhat more esoteric possibilities might include the /tmp directory being mounted from a shared NFS server or something like that.

You could try adding set :tmp_dir, '/home/user/tmp' to use an application specific temp directory.

I don't think this will help, but according to the doctor output, you aren't running the latest version of Capistrano. Could you upgrade just to rule out any fixes we've already addressed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants