Skip to content
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

feat: use Nokogiri's HUGE parse option #16

Merged

Conversation

flavorjones
Copy link
Contributor

@flavorjones flavorjones commented Apr 28, 2023

In sparklemotion/nokogiri#2865, which upgrades the latest libxml2 release, I started seeing failures that seem related to the larges sizes of the valgrind output files generated by Nokogiri's test suite:

Nokogiri::XML::SyntaxError: 360080:11: FATAL: internal error: Huge input lookup
/__w/nokogiri/nokogiri/lib/nokogiri/xml/reader.rb:99:in `read'
/__w/nokogiri/nokogiri/lib/nokogiri/xml/reader.rb:99:in `each'
/usr/local/bundle/gems/ruby_memcheck-1.3.1/lib/ruby_memcheck/test_task_reporter.rb:34:in `block in parse_valgrind_output'
/usr/local/bundle/gems/ruby_memcheck-1.3.1/lib/ruby_memcheck/test_task_reporter.rb:33:in `each'
/usr/local/bundle/gems/ruby_memcheck-1.3.1/lib/ruby_memcheck/test_task_reporter.rb:33:in `parse_valgrind_output'

I haven't dug in too much as to why libxml2 2.11.0 is complaining about this, but a lot of the buffering code got rewritten. See the release notes for more information, but the work is being described as:

Refactoring has begun on some buffering and encoding code with the goal of simplifying this part of the code base and improving error reporting.

In any case, setting the HUGE parse option will avoid these errors, at the cost of a slight performance tradeoff.

because some of these files get really big.
@peterzhu2118 peterzhu2118 merged commit 31e715d into Shopify:main May 17, 2023
peterzhu2118 added a commit to peterzhu2118/nokogiri that referenced this pull request May 17, 2023
Shopify/ruby_memcheck#16 has been merged and released, so we can move
back to released version of ruby_memcheck.
@flavorjones flavorjones deleted the flavorjones-nokogiri-huge-parse-option branch December 20, 2023 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants