-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid native function pointer (Polyglot::ForeignException)
with latest libxml2 2.11.0
#3031
Comments
It seems The line in the stacktrace is https://github.com/GNOME/libxml2/blob/v2.11.1/threads.c#L143 And https://github.com/GNOME/libxml2/blob/v2.11.1/threads.c#L28-L30 seems a likely difference between host and container. The
I suspect Sulong doesn't handle these weak symbols correctly. Is there maybe a way to configure libxml2 so it links to pthread or considers it loaded? |
Great catch. I'll explore configuring (or patching) libxml2. For posterity, the change to libxml2 around thread detection is described here: https://gitlab.gnome.org/GNOME/libxml2/-/issues/427 |
Because libxml2 2.11 changed how it does thread support detection and we're about to monkey with it in a patch. For context, see: - https://gitlab.gnome.org/GNOME/libxml2/-/issues/427 - oracle/truffleruby#3031
because the weak symbols won't work with truffleruby, for more context see: - oracle/truffleruby#3031
Attempt 1 to work around this was to patch
Attempt 2, then, was to add sparklemotion/nokogiri@4d5486d That seems to do the trick. This is running through CI now at sparklemotion/nokogiri#2866 |
Unfortunately, that change broke most of the linux CRuby builds and did not fix the |
Sorry for the complications, libxml2 does way too many hacky things there, and unfortunately that seems to result in hitting a bug in Sulong. It seems CRuby and
Maybe the Also it's under Instead of the |
I have found that for some libraries built as part of TruffleRuby, I pass |
In #3031 (comment) I think the issue is it fails on the So either skipping building xmllint or passing |
OK, I reset and discovered that there are two things going on:
For (1) I've submitted a fix upstream at https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/215 For (2) I'm considering making sure that pthreads are always compiled and linked in libxml2.so, including in TruffleRuby. |
See conversation with libxml2 maintainer at https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/215 but the TLDR is
Thanks for your help with this, you definitely helped me arrive at these decisions more quickly. |
I need some assistance understanding an issue I'm seeing with nokogiri and libxml2 2.11.0 (just released).
The error I'm seeing with
truffleruby 23.1.0-dev-17ec84b1, like ruby 3.1.3, GraalVM CE Native [x86_64-linux]
isLink to CI failure
I can easily reproduce this using the container image
ghcr.io/sparklemotion/nokogiri-test:truffle-nightly
but can't reproduce it on my dev host machine with the same version of truffle (installed via ruby-build).The code in question isn't obviously passing around an invalid function pointer:
Valgrind doesn't catch anything in native CRuby, and I can't actually reproduce this outside of the test container, so it's not reproducing in all TruffleRuby versions, either.
I'd love if someone could help me understand if there's a subtle bug in libxml2 that needs to be fixed, or whether this is something to do with the CI container environment, or if this is perhaps a Sulong issue?
The text was updated successfully, but these errors were encountered: