Skip to content

Issue when several processes use mbed cache in parallel  #660

@adamelhakham

Description

@adamelhakham

Hi,
We have a Jenkins job (on Ubuntu 14.04 machine) that runs mbed deploy multiple times in parallel in different directories. In order to speed things up we would like to use the cache feature.
However, occasionally, some of the processes run into the following issue:

[mbed] ERROR: Unknown Error: [('/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/objects/pack/pack-d51b52bd9a7c249c814d6dc49074452fe73c8e22.pack', '/sharedhome/adaelh01/work/parallel_cache_2/dir_8/mbed-os/.git/objects/pack/pack-d51b52bd9a7c249c814d6dc49074452fe73c8e22.pack', "[Errno 2] No such file or directory: '/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/objects/pack/pack-d51b52bd9a7c249c814d6dc49074452fe73c8e22.pack'"), ('/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/objects/pack', '/sharedhome/adaelh01/work/parallel_cache_2/dir_8/mbed-os/.git/objects/pack', "[Errno 2] No such file or directory: '/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/objects/pack'"), ('/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/objects/info', '/sharedhome/adaelh01/work/parallel_cache_2/dir_8/mbed-os/.git/objects/info', "[Errno 2] No such file or directory: '/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/objects/info'"), ('/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/objects', '/sharedhome/adaelh01/work/parallel_cache_2/dir_8/mbed-os/.git/objects', "[Errno 2] No such file or directory: '/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/objects'"), ('/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/branches', '/sharedhome/adaelh01/work/parallel_cache_2/dir_8/mbed-os/.git/branches', "[Errno 2] No such file or directory: '/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/branches'"), ('/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/refs', '/sharedhome/adaelh01/work/parallel_cache_2/dir_8/mbed-os/.git/refs', "[Errno 2] No such file or directory: '/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/refs'"), ('/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/info', '/sharedhome/adaelh01/work/parallel_cache_2/dir_8/mbed-os/.git/info', "[Errno 2] No such file or directory: '/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/info'"), ('/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/HEAD', '/sharedhome/adaelh01/work/parallel_cache_2/dir_8/mbed-os/.git/HEAD', "[Errno 2] No such file or directory: '/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/HEAD'"), ('/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/ORIG_HEAD', '/sharedhome/adaelh01/work/parallel_cache_2/dir_8/mbed-os/.git/ORIG_HEAD', "[Errno 2] No such file or directory: '/home/adaelh01/.mbed/cache-2/mbed-cache/github.com/ARMmbed/mbed-os/.git/ORIG_HEAD'")]
---

Currently, in order to avoid this issue we turn off the cache feature with mbed cache off
Is the cache feature supposed to support parallel usage?

For convenience, I've added a simple shell script that reproduces the issue (calls mbed deploy in a loop from 8 different directories in parallel). It usually takes 10-20 minutes for one of the sub processes to produce the error:

set -e

function deploy_libs {
	while true; do
		cd "$1"
		rm -rf mbed-os
		if [ ! -f .mbed ]; then
			mbed new .
		fi

		mbed deploy -vvv
		cd ../
	done	
}

# Created dirs with .libs
for idx in 1 2 3 4 5 6 7 8
do
	mkdir "dir_$idx"
	touch "dir_$idx/mbed-os.lib"
	echo "[email protected]:ARMmbed/mbed-os.git#f9ee4e849f8cbd64f1ec5fdd4ad256585a208360" > "dir_$idx/mbed-os.lib"
done

# Deploy in parallel
for idx in 1 2 3 4 5 6 7 8
do
	deploy_libs "dir_$idx" &
done

wait

Thanks!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions