Parallel buildpack compilations fail
See original GitHub issueWhat version of Cloud Foundry are you using? 1.8
What version of the buildpack you are using? 4.3.24
If you were attempting to accomplish a task, what was it you were attempting to do? Use Jenkins parallel pipeline to deploy the same app to two spaces at the same time. In our case, we were deploying to dev and qa spaces in the same org. Its possible that a feature branch and a formal dev or qa build could be happening near simulataneous which could also create this issue. Its repeatable 100% of the time if you use the parallel pipeline in jenkins.
What did you expect to happen? Expected the build to work. 😃 Not using a parallel build works fine. As soon as we enabled parallel, it broke.
What was the actual behavior?
ERR OSError: [Errno 17] File exists: '/tmp/app/logs'
It looks as if the the tmp path is hardcoded to /tmp/app/logs and doesnt use a safe create directory method. IIf both builds end up staging on the same stg server, then obviously there will be a conflict and the directory for one of the builds will already exist.
Entire log output:
2016-12-28T16:48:18.51-0600 [STG/0] OUT Downloading go_buildpack_v1_7_12... 2016-12-28T16:48:18.51-0600 [STG/0] OUT Downloading java_buildpack_offline... 2016-12-28T16:48:18.51-0600 [STG/0] OUT Downloading go_buildpack... 2016-12-28T16:48:18.51-0600 [STG/0] OUT Downloading nodejs_buildpack... 2016-12-28T16:48:18.51-0600 [STG/0] OUT Downloading ruby_buildpack... 2016-12-28T16:48:18.52-0600 [STG/0] OUT Downloaded ruby_buildpack 2016-12-28T16:48:18.52-0600 [STG/0] OUT Downloaded nodejs_buildpack 2016-12-28T16:48:18.52-0600 [STG/0] OUT Downloading staticfile_buildpack... 2016-12-28T16:48:18.52-0600 [STG/0] OUT Downloaded go_buildpack 2016-12-28T16:48:18.52-0600 [STG/0] OUT Downloading php_buildpack_orig... 2016-12-28T16:48:18.52-0600 [STG/0] OUT Downloaded go_buildpack_v1_7_12 2016-12-28T16:48:18.53-0600 [STG/0] OUT Downloading python_buildpack... 2016-12-28T16:48:18.53-0600 [STG/0] OUT Downloaded java_buildpack_offline 2016-12-28T16:48:18.53-0600 [STG/0] OUT Downloading php_buildpack... 2016-12-28T16:48:18.53-0600 [STG/0] OUT Downloading binary_buildpack... 2016-12-28T16:48:18.54-0600 [STG/0] OUT Downloaded php_buildpack 2016-12-28T16:48:18.54-0600 [STG/0] OUT Downloading dotnet-core-buildpack... 2016-12-28T16:48:18.54-0600 [STG/0] OUT Downloaded php_buildpack_orig 2016-12-28T16:48:18.54-0600 [STG/0] OUT Downloaded staticfile_buildpack 2016-12-28T16:48:18.54-0600 [STG/0] OUT Downloaded binary_buildpack 2016-12-28T16:48:18.54-0600 [STG/0] OUT Downloaded python_buildpack 2016-12-28T16:48:18.54-0600 [STG/0] OUT Downloaded dotnet-core-buildpack 2016-12-28T16:48:18.54-0600 [STG/0] OUT Creating container 2016-12-28T16:48:18.77-0600 [STG/0] OUT Successfully created container 2016-12-28T16:48:18.77-0600 [STG/0] OUT Downloading app package... 2016-12-28T16:48:19.48-0600 [STG/0] OUT Downloaded app package (6M) 2016-12-28T16:48:19.48-0600 [STG/0] OUT Staging... 2016-12-28T16:48:20.77-0600 [STG/0] OUT -------> Buildpack version 4.3.24 2016-12-28T16:48:20.77-0600 [STG/0] ERR Traceback (most recent call last): 2016-12-28T16:48:20.77-0600 [STG/0] ERR File "/tmp/buildpacks/c924bf7a9c0f7afb68671e7d287bcbb8/scripts/compile.py", line 37, in <module> 2016-12-28T16:48:20.77-0600 [STG/0] ERR .method(setup_log_dir) 2016-12-28T16:48:20.77-0600 [STG/0] ERR File "/tmp/buildpacks/c924bf7a9c0f7afb68671e7d287bcbb8/lib/build_pack_utils/builder.py", line 512, in method 2016-12-28T16:48:20.77-0600 [STG/0] ERR execute(self.builder._ctx) 2016-12-28T16:48:20.77-0600 [STG/0] ERR File "/tmp/buildpacks/c924bf7a9c0f7afb68671e7d287bcbb8/lib/compile_helpers.py", line 71, in setup_log_dir 2016-12-28T16:48:20.77-0600 [STG/0] ERR os.makedirs(os.path.join(ctx['BUILD_DIR'], 'logs')) 2016-12-28T16:48:20.77-0600 [STG/0] ERR File "/usr/lib/python2.7/os.py", line 157, in makedirs 2016-12-28T16:48:20.77-0600 [STG/0] ERR mkdir(name, mode) 2016-12-28T16:48:20.77-0600 [STG/0] ERR OSError: [Errno 17] File exists: '/tmp/app/logs' 2016-12-28T16:48:20.77-0600 [STG/0] ERR Failed to compile droplet 2016-12-28T16:48:20.77-0600 [STG/0] OUT Exit status 223 2016-12-28T16:48:20.78-0600 [STG/0] ERR Staging failed: Exited with status 223 2016-12-28T16:48:20.79-0600 [STG/0] OUT Destroying container 2016-12-28T16:48:20.83-0600 [API/1] ERR Failed to stage application: staging failed 2016-12-28T16:48:21.16-0600 [STG/0] OUT Successfully destroyed container
Please confirm where necessary:
- I have included a log output
- My log includes an error message
- I have included steps for reproduction
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
Work-around for posterity: do not use parallel pipeline.
@bobbyhubbard - Is Jenkins using
cf
to do the push or the CF Java client? There are somethings incf
which are not parallel safe (i.e. if you run two instances ofcf
simultaneously, you could be in for a bad time). If you’re using Jenkins to drivecf
, you want to make sure that you’re using theCF_HOME
environment variable to pointcf
to a different config location. This helps with concurrency issues around thecf
config / state and eliminates a lot of problems.