Project

General

Profile

Bug #15844

VM has trouble releasing memory (?) on NoMethodError

Added by alangano (Alan Gano) 7 months ago. Updated 7 months ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
[ruby-core:92628]

Description

When the test case is run, the process goes haywire. I observe RSS bouncing around, and trending upwards. CPU on the process is at 100%.

The test case is a partial implementation of a binary tree which is also a doubly linked list. I chopped it down as far as I could.

The issue is triggered by a calling a non-existent method on the Tree object. The test case only has 100 nodes -- it should be instantaneous. I kill it after some 6+ minutes with RSS hitting upwards of 5GB.

I am working in 2.6.3. Duplicated in 2.5.3 and 2.4.3 (with some code modifications)


Files

issue.rb (2.67 KB) issue.rb test case alangano (Alan Gano), 05/12/2019 08:15 PM

History

#1

Updated by alangano (Alan Gano) 7 months ago

  • Subject changed from VM has trouble releasing memory (?)` on NoMethodError to VM has trouble releasing memory (?) on NoMethodError

Updated by nobu (Nobuyoshi Nakada) 7 months ago

  • Status changed from Open to Rejected

On exiting by an exception, ruby tries to print the exception and NoMethodError shows its receiver.
Your Node is a recursive construction, so it increases exponentially by the size.
Define your own inspect method not to include @left and @right members.

Updated by duerst (Martin Dürst) 7 months ago

nobu (Nobuyoshi Nakada) wrote:

On exiting by an exception, ruby tries to print the exception and NoMethodError shows its receiver.
Your Node is a recursive construction, so it increases exponentially by the size.

Recursion should not be a problem. Cycles definitely will be a problem.

Define your own inspect method not to include @left and @right members.

This is definitely the right way to go. But would it make sense to wrap the error output in a timeout, to make it easier to debug such problems in the field? I can create a feature for this.

Also available in: Atom PDF