You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add time and memory limit checks for `inspect` and `to_s`
Some automatic UI-related queries to the debugger may cause
OOM or hangs in the case of recursive or just very large data
structures being inspected. This commit adds the possibility
(enabled by default) to add time and memory limits for dangerous
calls to objects from a user codebase.
Related: RUBY-18275, RUBY-18121, RUBY-19520.
Commits reviewed and squashed:
* inspect memory limit
* cleanup
* Option to disable memory check is added
* disable memory limit in the same option
* cleanup: formating fix, rename variable, rewrite on "compact = if (...)"
* fixed exeption message
* memory limit logging added
* debug output deleted
* print_msg -> print_debug
* object_id deleted from the exeption message
* Fixes according to the review
* timelimit for inspect evaluation added
* The handler is called with a probability of 25%
* cleanup
* inspect_with_alloc_control -> exec_with_... and heuristic break for variable inspect
* fixes according to reiew
curr_thread.raiseTimeLimitError.new("Timeout: evaluation of #{exec_method} took longer than #{time_limit}ms.","#{caller.map{|l| "\t#{l}"}.join("\n")}")
curr_thread.raiseMemoryLimitError.new("Out of memory: evaluation of #{exec_method} took more than #{memory_limit}mb.","#{caller.map{|l| "\t#{l}"}.join("\n")}")
0 commit comments