-
-
Notifications
You must be signed in to change notification settings - Fork 897
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
Clean up error handling in the C extension. #2096
base: main
Are you sure you want to change the base?
Clean up error handling in the C extension. #2096
Conversation
Code Climate has analyzed commit 426fd89 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (80% is the threshold). This pull request will bring the total coverage in the repository to 94.3% (0.0% change). View more on Code Climate. |
✅ Build nokogiri 1.0.707 completed (commit ccebed86e0 by @flavorjones) |
which was introduced in ruby v1_9_0_3
this will be useful to do some cleanup when we eventually decide to bump our libxml2 dependency.
and - remove platform-specific "-D" flags - remove `vasprintf_free` - change calls to `vasprintf_free` to call `free`
3bae5cc
to
426fd89
Compare
✅ Build nokogiri 1.0.710 completed (commit 7ab0da6e4f by @flavorjones) |
Braindumping some notes here so I don't lose them:
|
Any update? :) |
Hi, @LifeIsStrange! It's great to know people are interested in seeing this work get done. I'm curious why you're interested? Is there a specific problem you're running into that I can help with in the meantime? |
hi @flavorjones I'm just a nerd interested in Truffleruby as a technology, and I heard that this issue is a blocker for Ruby on Rails support for truffleruby. |
@LifeIsStrange thanks for clarifying. To be clear, Nokogiri almost entirely works fine on TruffleRuby, see our CI pipeline here:
These failures are specific to Sulong's lack of support for some types of C callbacks, and can't be fixed without addressing that support. However, the affected functionality is mostly related to error handling during SAX parsing, and so if that's not critical to you, then everything will probably work fine! If you're having Nokogiri-specific issues running on Rails+TruffleRuby, though, please do let us know in a new issue! |
related to exception handling in libxml2 callbacks, see #2096 for related work
related to exception handling in libxml2 callbacks, see #2096 for related work
related to exception handling in libxml2 callbacks, see #2096 for related work
related to exception handling in libxml2 callbacks, see #2096 for related work
related to exception handling in libxml2 callbacks, see #2096 for related work
related to exception handling in libxml2 callbacks, see #2096 for related work
**What problem is this PR intended to solve?** I think the stack trace changed with ruby/ruby@51bd8165, see for example https://github.com/sparklemotion/nokogiri/actions/runs/9935752042/job/27442553528 I'm not sure why this is the only leak showing up now, but am deferring further study until I devote some time to cleaning up known leaks where we raise exceptions in Ruby callbacks (from libxml2), see #2096 and #1610
This PR is for a set of accumulated changes in the C extension around libxml2 error handling.
I'd like to, whenever possible, avoid raising an exception from a native C callback. This is primarily to do with preventing memory leaks as detailed in #1610, but also to allow TruffleRuby to unwind the stack properly as detailed in #1882. I'm creating it as a draft so that I can get incremental feedback from CI as I go.