Code Monkey home page Code Monkey logo

Comments (11)

jatindhankhar avatar jatindhankhar commented on August 18, 2024 8

Encountered the same error, with both heapdump and custom command -e flag.

Looks like it's mac specific.
Same command worked on linux machine

Ruby - 2.5.1
OSX - 10.14.6

bundle exec rbtrace -p 6563 --heapdump
*** attached to process 6563
*** detached from process 6563
Traceback (most recent call last):
        7: from /Users/jatindhankhar/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'
        6: from /Users/jatindhankhar/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval'
        5: from /Users/jatindhankhar/.rvm/gems/ruby-2.5.1/bin/rbtrace:23:in `<main>'
        4: from /Users/jatindhankhar/.rvm/gems/ruby-2.5.1/bin/rbtrace:23:in `load'
        3: from /Users/jatindhankhar/.rvm/gems/ruby-2.5.1/gems/rbtrace-0.4.11/bin/rbtrace:5:in `<top (required)>'
        2: from /Users/jatindhankhar/.rvm/gems/ruby-2.5.1/gems/rbtrace-0.4.11/lib/rbtrace/cli.rb:502:in `run'
        1: from /Users/jatindhankhar/.rvm/gems/ruby-2.5.1/gems/rbtrace-0.4.11/lib/rbtrace/rbtracer.rb:146:in `eval'
/Users/jatindhankhar/.rvm/gems/ruby-2.5.1/gems/rbtrace-0.4.11/lib/rbtrace/rbtracer.rb:324:in `send_cmd': command is too long (ArgumentError)

from rbtrace.

robreinhold avatar robreinhold commented on August 18, 2024 3

Hey, I know why this is happening on Macs, and the fix is probably easy. I updated the raise arguments in rbtracer.rb, and got this:

Traceback (most recent call last):
        5: from /Users/robreinhold/.rbenv/versions/2.6.6/bin/rbtrace:23:in `<main>'
        4: from /Users/robreinhold/.rbenv/versions/2.6.6/bin/rbtrace:23:in `load'
        3: from /Users/robreinhold/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rbtrace-0.4.14/bin/rbtrace:5:in `<top (required)>'
        2: from /Users/robreinhold/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rbtrace-0.4.14/lib/rbtrace/cli.rb:467:in `run'
        1: from /Users/robreinhold/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rbtrace-0.4.14/lib/rbtrace/rbtracer.rb:146:in `eval'
/Users/robreinhold/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rbtrace-0.4.14/lib/rbtrace/rbtracer.rb:326:in `send_cmd': command is too long: [��eval��Thread.new do; begin; output = '/var/folders/0r/jv9m1ks54v1fbgy3nzz1ysp00000gn/T/output20200924-78777-1o2e8ga'; eval(File.read('/Users/robreinhold/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/rbtrace-0.4.14/lib/rbtrace/memory_report.rb')); end; end] (ArgumentError)

The cmd here is 240ish characters, and is being checked against MsgQ::EventMsg::BUF_SIZE

This is defined as:

BUF_SIZE = RUBY_PLATFORM =~ /linux/ ? 256 : 120

The output parameter in the command is generated by Tempfile.new. I suspect that Mac started doing temp files differently or something, and the paths are now much longer than before.

Hard-coding BUF_SIZE to 256 got me a new error:

Error: argument --pid (process already being traced?)

from rbtrace.

vaidhyanathan-ananthakrishnan avatar vaidhyanathan-ananthakrishnan commented on August 18, 2024 2

same problem in ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin17.0]

from rbtrace.

lvohra avatar lvohra commented on August 18, 2024 1

i followed a small trick here, i shorten the command by generating the dump in project custom dir with shorten filename(or even you can directly go to tmp dir.

from project root, run the below

bundle exec rbtrace -p 20740 -e 'Thread.new{GC.start;require "objspace";io=File.open("./r.json","w");ObjectSpace.dump_all(output:io);io.close}'

it sucks, if you want to add trace_object_allocations_start. however you can keep it in your app environment config. 👯 👯‍♂️

from rbtrace.

SamSaffron avatar SamSaffron commented on August 18, 2024

Yeah there is a limit to the amount of data we can send via the signal, we need to establish an extra backchannel here. Surprised it is happening on --memory though but I guess that path is pretty deep there.

from rbtrace.

themoah avatar themoah commented on August 18, 2024

same here.
@arthurnn what ruby version are you running ? on what OS ?

from rbtrace.

arthurnn avatar arthurnn commented on August 18, 2024

Ruby 2.4.0 - OSX 10.13.4

from rbtrace.

ankopainting avatar ankopainting commented on August 18, 2024

same problem, ruby 2.5.3, macos 10.14

from rbtrace.

Voxoff avatar Voxoff commented on August 18, 2024

Same: ruby 2.5.3p105 (2018-10-18 revision 65156), macos, 10.14.1

from rbtrace.

jkburges avatar jkburges commented on August 18, 2024

For anyone else wondering about rbtrace architecture w.r.t. this issue, I found this blog quite useful: https://balazs.kutilovi.cz/posts/ruby-tracing-part-two-rbtrace/

from rbtrace.

mcclymont avatar mcclymont commented on August 18, 2024

Is the BUF_SIZE of 120 a hard limit on OSX?

from rbtrace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.