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

1.10.0 - jruby 9.13.0-p0 memory leak very fast. #1873

Closed
WoolenWang opened this issue Feb 22, 2019 · 3 comments
Closed

1.10.0 - jruby 9.13.0-p0 memory leak very fast. #1873

WoolenWang opened this issue Feb 22, 2019 · 3 comments

Comments

@WoolenWang
Copy link

Do not report Security Vulnerabilities here

If you intend to report a security vulnerability, please do so at HackerOne following the process detailed in SECURITY.md. Do not report it through GitHub.

Describe the bug
Use jruby 9.13.0-p0 with nokogiri 1.10.0 parse the one xml file (pretty big file [4MB/ 3.5W line])

use xpath to locate the node. and then get very fast memory leak

image

image

image

To Reproduce

#! /usr/bin/env ruby

require 'nokogiri'
require 'minitest/autorun'

class Test < MiniTest::Spec
  describe "Node#css" do
    it "should find a div using chained classes" do
      if File.exist? index_file
          index_xml = Nokogiri::XML(File.open(index_file))
          all_file = index_xml.xpath("//compound[@kind='file']")
          all_file.each do |one_file|
            file_name = "#{one_file.xpath('./name').first.inner_text}"
            if CODE_LOGGER_CFG['doxygen']['filter_header']
              if file_name =~ /.*\.(h|hpp|h\+\+|hh)$/
                next
              end
            end
            one_file_hash = {
              :name => file_name,
              :id => one_file['refid'],
              :functions => {}
            }
            file_hash[one_file['refid']] = one_file_hash
            functions = one_file.xpath('./member[@kind="function"]')
            functions.each do |one_func|
              one_func_hash = {
                :name => "#{one_func.xpath('./name').first.inner_text}",
                :id => one_func['refid'],
                :file => one_file_hash
              }
              function_hash[one_func['refid']] = one_func_hash
            end
          end
      
      assert_equal 1, 1
    end
  end
end

index.xml.docx

If you haven't included a test, please provide whatever code you can, the inputs if any, along with the output that you're seeing. We need to reproduce what you're seeing to be able to help.

Expected behavior

memory not leak.

Environment

nokogiri 1.10.0 - jruby 9.13.0-p0

Additional context

@WoolenWang
Copy link
Author

it seems like the bug was bring back from #1792

the patch manager is very Disaster

@WoolenWang
Copy link
Author

.... oh i figure it out , the logstash Entrance use the old version 1.8.5 nokogiri which has this problem, but the new 1.10.0 is fix, but the jruby has two version of nokogiri the logstash has gemfile lock to 1.8.5, make it to 1.10.0 the problem fix.

@jvshahid
Copy link
Member

Sounds like you figured out what the problem was. I will go ahead and close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants