Bypass library finalisation to fix libgomp crash#1202
Conversation
|
40 successful runs of Linux CI 🤞 |
| - name: Configure R compilation flags | ||
| run: | | ||
| mkdir -p ~/.R | ||
| echo "CPPFLAGS += -I$(brew --prefix gettext)/include" >> ~/.R/Makevars | ||
| echo "LDFLAGS += -L$(brew --prefix gettext)/lib" >> ~/.R/Makevars |
There was a problem hiding this comment.
i think a note about this being for data table when we need to compile from source would be useful, otherwise im left going 'wtf is this for'
There was a problem hiding this comment.
it's for any package we need to compile, not just data.table. It's basic Makevars configuration for that runner
There was a problem hiding this comment.
# This configures Makevars to look for brew headers and libraries. Useful
# to compile packages used in tests when they have just been released to
# CRAN and there is no binary we can download yet. We've needed this for
# data.table.
There was a problem hiding this comment.
I rarely if ever need to fiddle with makevars on ci anymore, even for compiled packages, so some kind of justification always feels necessary when i need to have something like this
There was a problem hiding this comment.
i think we should do this instead
its tailor made for this use case
R no longer bundles libintl, and the current setup-r-dependencies action r-lib/actions#998, so it was recommended we use separate action for this
and libintl was the problem
There was a problem hiding this comment.
Not sure about tailor made for this use case. It's presented as one of the potential solutions, along with installing the dep yourself.
In this case we already have the system lib, somehow, so downloading all sys reqs again (326mb) to extract a copy in /opt/R seems a bit heavy handed compared to pointing R to the brew files. Perhaps it's more future proof than whatever we did to the CI setup causing the sysreq to be already installed by brew. I wouldn't worry about this for now though.
(Hopefully) fixes these flakes:
libgomp is a library loaded via BLAS on our Ubuntu runners. The stderr output indicates that the library is getting initialised a second time, triggering this assertion abort.
We still don't know why libgomp is getting initialised a second time, but we know that it happens after the test passed (e.g.
okresult in output). We also know fromLD_DEBUGoutput that it happens during linked library teardown when the process exits:According to glibc'd deepwiki, library finalisation happens via the atexit hook, registered very early by the dynamic linker at process startup. The workaround implemented in this PR is to register an atexit hook in the test harness on Linux to call
_exit(), which is documented to exit immediately without any further cleanup (https://man7.org/linux/man-pages/man2/_exit.2.html):Furthermore, from
exit()(https://man7.org/linux/man-pages/man3/exit.3.html):So exiting with code 0 from an atexit hook should circumvent all this library finalisation procedure.