comic / evalutils

evalutils helps users create extensions for grand-challenge.org
https://grand-challenge.org
MIT License
23 stars 9 forks source link

Github CI - running the test.sh script (run from ci.yml) runs infinitely #321

Closed ghost closed 2 years ago

ghost commented 2 years ago

Description

What I did: push to remote Github CI runs according to the .github/workflows/ci.yml file, but never ends (well, I stopped it after 3 hours, where it takes ~ 1 minute on my local machine, so theoretically I am assuming it is infinite, but I am not waiting around to find out ;)

What I Did

Cmd: git push
Github GUI / Actions tab / Action just keeps running... and running... and running
jmsmkn commented 2 years ago

Do you have any logs?

ghost commented 2 years ago

Debugged this and found it was down to the cmd cat /dev/urandom, which is never really an advisable thing to do as it is same as e.g. cat /dev/zero or cat /dev/null which are "kernel" devices which will just keep pumping out bytes as long as cat is reading them...

Solution: you really want to limit the number of bytes returned from the call to /dev/urandom. A clean way of doing this is e.g. via dd if=/dev/urandom bs=32 count=1 to return 32 bytes and terminate there so the next command can run.

I replaced the call to /dev/urandom in my local test.sh script with this which works nicely on Github CI now:

VOLUME_SUFFIX=$(dd if=/dev/urandom bs=32 count=1 | md5sum | cut --delimiter=' ' --fields=1)

Before you ask: no I don't know for sure why the call to cat /dev/random actually terminates when I run it locally on my machine in the script. I can only imagine it has to do with some user limit being reached at which point the reading from /dev/urandom is broken off and processing continues

jmsmkn commented 2 years ago

PR with that would be welcome

ghost commented 2 years ago

PR with that would be welcome

On its way :-) plus some other "nice-to-have" shell script fixes in there for the generated "build.sh" and "test.sh" files - I think I might pull them out into separate commits though - one commit for this issue specifically and another commit for an issue I will create re general shell script improvements for build.sh and test.sh, that way we keep things nice and clean and trackable.

I have already forked the comic/evalutils repo so will push to my fork then do a PR rom my fork to the main repo hopefully later today for you

ghost commented 2 years ago

Do you have any logs?

Yes but nothing to actually see, simply no output as cmd cat /dev/urandom runs forever