[11.6.1] Cache not copy when two jobs are started at the same time for a pipeline

Summary

When a build is started with 2 jobs in parallel, the cache is not present for one of the two jobs.

Steps to reproduce

gitlab-runner configured for 5 concurrent jobs

Actual behavior

gitlab runner configured for 5 concurrent jobs Pipeline : dep > test_lint/test_unit > doc (pages) dep : no problem (build cache ok) test : error with 1 of 2 jobs (get cache ko for 1 job)

gitlab runner configured for 1 concurrent job Pipeline : dep > test_lint/test_unit > doc (pages) dep : no problem (build cache ok) test : no problem (get cache ok)

Expected behavior

gitlab runner configured for 5 concurrent jobs Pipeline : dep > test_lint/test_unit > doc (pages) dep : no problem (build cache ok) test : no problem (get cache ok)

gitlab runner configured for 1 concurrent job Pipeline : dep > test_lint/test_unit > doc (pages) dep : no problem (build cache ok) test : no problem (get cache ok)

Relevant logs and/or screenshots

logs without error

Running with gitlab-runner 11.6.1 (8d829975)
  on local njdBHAMf
Using Docker executor with image node:8.2.1 ...
Pulling docker image node:8.2.1 ...
Using docker image sha256:b17af62b0dea16765b95b1bbef4e4478a546c3565e3083e39ac179eee613afac for node:8.2.1 ...
Running on runner-njdBHAMf-project-26-concurrent-0 via ip-10-100-10-212...
Fetching changes...
Removing jest_0/
Removing node_modules/
HEAD is now at 49da7b3 Update .gitlab-ci.yml
Checking out 49da7b35 as develop...
Skipping Git submodules setup
Checking cache for deps-49da7b3596acd9cbe857e5a0f7fe11310bc00fdb...
No URL provided, cache will be not downloaded from shared cache server. Instead a local version of cache will be extracted. 
Successfully extracted cache
$ ls -lah
total 900K
drwxrwxrwx   13 root root 4.0K Jan 17 14:44 .
drwxrwxrwx    4 root root 4.0K Jan 17 14:27 ..
-rw-rw-rw-    1 root root  152 Jan 17 14:27 .babelrc
drwxrwxrwx    2 root root 4.0K Jan 17 14:27 .circleci
-rw-rw-rw-    1 root root  287 Jan 17 14:27 .editorconfig
-rw-rw-rw-    1 root root   48 Jan 17 14:27 .eslintignore
-rw-rw-rw-    1 root root 1.6K Jan 17 14:27 .eslintrc
drwxrwxrwx    5 root root 4.0K Jan 17 14:44 .git
-rw-rw-rw-    1 root root   63 Jan 17 14:27 .gitignore
-rw-rw-rw-    1 root root  822 Jan 17 14:41 .gitlab-ci.yml
-rw-rw-rw-    1 root root    6 Jan 17 14:27 .nvmrc
drwxrwxrwx    2 root root 4.0K Jan 17 14:27 .storybook
-rw-rw-rw-    1 root root  155 Jan 17 14:27 .stylelintrc
-rw-rw-rw-    1 root root 4.6K Jan 17 14:27 README.md
drwxrwxrwx    3 root root 4.0K Jan 17 14:27 __mocks__
drwxrwxrwx    2 root root 4.0K Jan 17 14:27 deploy
drwxrwxrwx    3 root root 4.0K Jan 17 14:27 docs
-rw-rw-rw-    1 root root  257 Jan 17 14:27 jest.config.js
drwxrwxrwx    3 root root 4.0K Jan 17 14:44 jest_0
drwxr-xr-x 1351 root root  48K Jan 17 14:42 node_modules
-rw-rw-rw-    1 root root 751K Jan 17 14:43 package-lock.json
-rw-rw-rw-    1 root root 3.9K Jan 17 14:27 package.json
drwxrwxrwx    2 root root 4.0K Jan 17 14:27 public
drwxrwxrwx   12 root root 4.0K Jan 17 14:27 src
drwxrwxrwx    3 root root 4.0K Jan 17 14:27 test

logs with error

Running with gitlab-runner 11.6.1 (8d829975)
  on local njdBHAMf
Using Docker executor with image node:8.2.1 ...
Pulling docker image node:8.2.1 ...
Using docker image sha256:b17af62b0dea16765b95b1bbef4e4478a546c3565e3083e39ac179eee613afac for node:8.2.1 ...
Running on runner-njdBHAMf-project-26-concurrent-1 via ip-10-100-10-212...
Fetching changes...
Removing node_modules/
HEAD is now at 1008459 Update .gitlab-ci.yml
From http://gitlab.tools.frichti.co/frontend/backoffice
   1008459..49da7b3  develop    -> origin/develop
Checking out 49da7b35 as develop...
Skipping Git submodules setup
Checking cache for deps-49da7b3596acd9cbe857e5a0f7fe11310bc00fdb...
No URL provided, cache will be not downloaded from shared cache server. Instead a local version of cache will be extracted. 
Successfully extracted cache
$ ls -lah
total 844K
drwxrwxrwx 11 root root 4.0K Jan 17 14:49 .
drwxrwxrwx  4 root root 4.0K Jan 17 14:28 ..
-rw-rw-rw-  1 root root  152 Jan 17 14:28 .babelrc
drwxrwxrwx  2 root root 4.0K Jan 17 14:28 .circleci
-rw-rw-rw-  1 root root  287 Jan 17 14:28 .editorconfig
-rw-rw-rw-  1 root root   48 Jan 17 14:28 .eslintignore
-rw-rw-rw-  1 root root 1.6K Jan 17 14:28 .eslintrc
drwxrwxrwx  5 root root 4.0K Jan 17 14:49 .git
-rw-rw-rw-  1 root root   63 Jan 17 14:28 .gitignore
-rw-rw-rw-  1 root root  822 Jan 17 14:49 .gitlab-ci.yml
-rw-rw-rw-  1 root root    6 Jan 17 14:28 .nvmrc
drwxrwxrwx  2 root root 4.0K Jan 17 14:28 .storybook
-rw-rw-rw-  1 root root  155 Jan 17 14:28 .stylelintrc
-rw-rw-rw-  1 root root 4.6K Jan 17 14:28 README.md
drwxrwxrwx  3 root root 4.0K Jan 17 14:28 __mocks__
drwxrwxrwx  2 root root 4.0K Jan 17 14:28 deploy
drwxrwxrwx  3 root root 4.0K Jan 17 14:28 docs
-rw-rw-rw-  1 root root  257 Jan 17 14:28 jest.config.js
-rw-rw-rw-  1 root root 751K Jan 17 14:34 package-lock.json
-rw-rw-rw-  1 root root 3.9K Jan 17 14:28 package.json
drwxrwxrwx  2 root root 4.0K Jan 17 14:28 public
drwxrwxrwx 12 root root 4.0K Jan 17 14:28 src
drwxrwxrwx  3 root root 4.0K Jan 17 14:28 test

Same code for both

Environment description

Gitlab and Gitlab-runner self hosted Gitlab : 11.6.4 Gitlab-runner (docker executor and privileged) : 11.6.1

docker version
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:24:51 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:23:15 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Used GitLab Runner version

Version:      11.6.1
Git revision: 8d829975
Git branch:   11-6-stable
GO version:   go1.8.7
Built:        2019-01-15T15:22:11+0000
OS/Arch:      linux/amd64