Hi,
Sharing doesn't cause this problem. The machine is indeed shared, but the environment not: every student's tests run in a docker container.
Have you taken a look at this thread? [1] Might solve your problem.
Cristina
[1] https://moodlearchive.epfl.ch/2020-2021/mod/forum/discuss.php?d=42548