Comments (11)
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.
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.
same problem in ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin17.0]
from rbtrace.
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.
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.
same here.
@arthurnn what ruby version are you running ? on what OS ?
from rbtrace.
Ruby 2.4.0 - OSX 10.13.4
from rbtrace.
same problem, ruby 2.5.3, macos 10.14
from rbtrace.
Same: ruby 2.5.3p105 (2018-10-18 revision 65156), macos, 10.14.1
from rbtrace.
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.
Is the BUF_SIZE of 120 a hard limit on OSX?
from rbtrace.
Related Issues (20)
- on ruby 1.8.7 it gives some sintax errors HOT 1
- With --ps, automatically listen to only choice HOT 1
- How come SIGURG is used? HOT 4
- PID not listening? HOT 4
- --pid (pid is not listening for messages ... HOT 11
- ruby 2.5.0dev (2017-11-10 trunk 60739) [x86_64-linux-gnu] breaks rbtrace HOT 1
- Ruby API rb_frame_method_id_and_class will be deprecated from Ruby 2.5 HOT 2
- process already being traced? HOT 3
- Gem dependency renamed to `Optimist`
- new release? HOT 3
- Dependency on a deprecated gem -- trollop
- ThreadError: can't be called from trap context
- the config.guess in msgpack-1.1.0.tar.gz is too old,and it cannot guess build type HOT 4
- Support for ruby2.7? HOT 1
- Native extension won’t compile on macOS 10.16/11.0 Big Sur beta
- 0.4.11 build fails on Mac OS 10.15.6 HOT 7
- backtrace option fails on macOS
- Unable to reattach to puma worker
- Add command option to print system time next to each trace
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rbtrace.