Github actions C++ build fails on ubuntu-18.04 when using ninja

I’m building a rather large C++ project. I have had weird failures on Ubuntu that I couldn’t understand for a while so I’ve tried a lot of different things (I thought maybe it was the disk space that was being exhausted, but apparently not at all).

After investigation, I could pinpoint the issue: when I specify ninja as the generator, the ubuntu-18.04 build starts fine then becomes unresponsive. With make it works.

I get two potential behavior:

1. The build log is available, and I see towards the end:

ninja: build stopped: interrupted by user.
Error: Process completed with exit code 143.

example: https://github.com/jmarrec/OpenStudio/runs/1531499049?check_suite_focus=true


2. The build log is unavailable. When I click to see Raw logs, I get this

2020-12-10T14:28:39.4555880Z ##[section]Starting: Request a runner to run this job
2020-12-10T14:28:40.2463326Z Can't find any online and idle self-hosted runner in current repository that matches the required labels: 'ubuntu-18.04'
2020-12-10T14:28:40.2463458Z Can't find any online and idle self-hosted runner in current repository's account/organization that matches the required labels: 'ubuntu-18.04'
2020-12-10T14:28:40.2463677Z Found online and idle hosted runner in current repository's account/organization that matches the required labels: 'ubuntu-18.04'
2020-12-10T14:28:40.3574754Z ##[section]Finishing: Request a runner to run this job

example: https://github.com/jmarrec/OpenStudio/runs/1531175070?check_suite_focus=true


An example of the same workflow that does work with make can be found in the list, title starts with " Ubuntu keeps unresponding… Try with make instead of ninja." (I cannot share more than 2 links).

Locally I sometimes gets some kind of almost freeze towards the end of the build with ninja, during the linking phase, where it tends to exhaust my physical resources. I don’t know how the GH action runner are configured, and if there is some kind of timeout or watchdog that checks if the system is unresponsive or not? Is there a way to tweak that value to a higher threshold?

Thanks!