ko1 / gc_tracer Goto Github PK
View Code? Open in Web Editor NEWAdd GC::Tracer module.
License: MIT License
Add GC::Tracer module.
License: MIT License
The module defined in ext/gc_tracer/gc_tracer.c is GC::Tracer, but in version.rb
is defined as GcTracer
.
$ grep gc_tracer Gemfile
gem 'gc_tracer'
$ bundle
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/slackz/.rbenv/versions/2.1.2/bin/ruby extconf.rb
checking for rb_obj_gc_flags() in ruby/ruby.h... yes
checking for sys/time.h... yes
checking for sys/resource.h... yes
checking for getrusage()... yes
checking for struct rusage.ru_maxrss in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_ixrss in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_idrss in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_isrss in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_minflt in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_majflt in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_nswap in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_inblock in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_oublock in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_msgsnd in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_msgrcv in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_nsignals in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_nvcsw in sys/time.h,sys/resource.h... yes
checking for struct rusage.ru_nivcsw in sys/time.h,sys/resource.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling gc_tracer.c
gc_tracer.c: In function ‘Init_gc_tracer’:
gc_tracer.c:846:5: warning: implicit declaration of function ‘rb_obj_gc_flags’ [-Wimplicit-function-declaration]
rb_obj_gc_flags(rb_cObject, NULL, 0);
^
gc_tracer.c:847:5: error: ‘id_young’ undeclared (first use in this function)
id_young = rb_intern("young");
^
gc_tracer.c:847:5: note: each undeclared identifier is reported only once for each function it appears in
make: *** [gc_tracer.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/slackz/repos/theclymb/.bundle/ruby/2.1.0/gems/gc_tracer-0.3.2 for inspection.
Results logged to /home/slackz/repos/theclymb/.bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/gc_tracer-0.3.2/gem_make.out
An error occurred while installing gc_tracer (0.3.2), and Bundler cannot
continue.
Make sure that `gem install gc_tracer -v '0.3.2'` succeeds before bundling.
-- C level backtrace information -------------------------------------------
/opt/rubies/2.7.0/bin/ruby(rb_vm_bugreport+0x96) [0x1017a5446]
/opt/rubies/2.7.0/bin/ruby(rb_bug+0xcc) [0x1017b1d66]
/opt/rubies/2.7.0/bin/ruby(newobj_slowpath+0x99c) [0x10160014c]
/opt/rubies/2.7.0/bin/ruby(newobj_slowpath_wb_protected+0x14) [0x1015ff784]
/opt/rubies/2.7.0/bin/ruby(rb_str_buf_new+0x1e) [0x10171b42e]
/opt/rubies/2.7.0/bin/ruby(rb_enc_vsprintf+0x48) [0x1017093e8]
/opt/rubies/2.7.0/bin/ruby(rb_vraise+0x14) [0x1015dbb34]
/opt/rubies/2.7.0/bin/ruby(rb_raise+0x7b) [0x1015d72db]
/opt/rubies/2.7.0/bin/ruby(rb_check_typeddata+0xf3) [0x1015d8753]
/opt/rubies/2.7.0/bin/ruby(tp_call_trace+0x2a) [0x1017a7c8a]
/opt/rubies/2.7.0/bin/ruby(rb_exec_event_hooks+0x163) [0x1017a6c93]
/opt/rubies/2.7.0/bin/ruby(rb_objspace_call_finalizer+0x8b7) [0x1015f4c87]
/opt/rubies/2.7.0/bin/ruby(rb_ec_cleanup+0x2de) [0x1015e310e]
/opt/rubies/2.7.0/bin/ruby(ruby_stop+0x9) [0x1015e31f9]
/opt/rubies/2.7.0/bin/ruby(rb_f_fork+0x98) [0x1016b5e28]
/opt/rubies/2.7.0/bin/ruby(vm_call_cfunc+0x170) [0x1017964a0]
/opt/rubies/2.7.0/bin/ruby(vm_exec_core+0x492b) [0x10177d3cb]
/opt/rubies/2.7.0/bin/ruby(rb_vm_exec+0xadc) [0x1017912bc]
/opt/rubies/2.7.0/bin/ruby(loop_i+0x29) [0x1017a11e9]
/opt/rubies/2.7.0/bin/ruby(rb_vrescue2+0x114) [0x1015e3e44]
/opt/rubies/2.7.0/bin/ruby(rb_rescue2+0x7b) [0x1015e3d0b]
/opt/rubies/2.7.0/bin/ruby(vm_call_cfunc+0x170) [0x1017964a0]
/opt/rubies/2.7.0/bin/ruby(vm_exec_core+0x3782) [0x10177c222]
/opt/rubies/2.7.0/bin/ruby(rb_vm_exec+0xadc) [0x1017912bc]
/opt/rubies/2.7.0/bin/ruby(load_iseq_eval+0xb9) [0x10163cdd9]
/opt/rubies/2.7.0/bin/ruby(require_internal+0x2f1) [0x10163bae1]
/opt/rubies/2.7.0/bin/ruby(rb_f_require+0x21) [0x10163b021]
/opt/rubies/2.7.0/bin/ruby(vm_call_cfunc+0x170) [0x1017964a0]
/opt/rubies/2.7.0/bin/ruby(vm_exec_core+0x38df) [0x10177c37f]
/opt/rubies/2.7.0/bin/ruby(rb_vm_exec+0xadc) [0x1017912bc]
/opt/rubies/2.7.0/bin/ruby(rb_ec_exec_node+0xc6) [0x1015e33c6]
/opt/rubies/2.7.0/bin/ruby(ruby_run_node+0x55) [0x1015e32a5]
/opt/rubies/2.7.0/bin/ruby(main+0x5d) [0x10153c29d]
From my understanding an invalid type is passed to tp_call_trace
, and then it crashes because it tries to allocate an exception during a GC run.
I can reproduce this reliably on my app, and can work around with at_exit { GC::Tracker.disable }
.
https://github.com/ko1/gc_tracer/blob/master/ext/gc_tracer/gc_logging.c#L737
rb_define_module_function(mod, "setup_looging_custom_fields=", gc_tracer_setup_logging_custom_fields, 1);
I believe it should be logging
, not looging
...
I would love to use this on Windows if possible.
C:/Ruby215p273/bin/ruby.exe extconf.rb
checking for rb_obj_gc_flags() in ruby/ruby.h... yes
checking for sys/time.h... yes
checking for sys/resource.h... no
checking for time.h... yes
checking for clock_gettime()... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating gc_tracer-i386-mingw32.def
compiling gc_logging.c
In file included from gc_logging.c:15:0:
gc_tracer.h: In function 'setup_gc_trace_symbols':
gc_tracer.h:33:5: error: 'sym_rusage_timeval' undeclared (first use in this function)
gc_tracer.h:33:5: note: each undeclared identifier is reported only once for each function it appears in
gc_logging.c: In function 'fill_rusage':
gc_logging.c:150:16: error: 'struct gc_logging' has no member named 'filled_rusage'
gc_logging.c:151:9: error: 'struct gc_logging' has no member named 'filled_rusage'
gc_logging.c:152:2: warning: implicit declaration of function 'getrusage' [-Wimplicit-function-declaration
gc_logging.c:152:12: error: 'RUSAGE_SELF' undeclared (first use in this function)
gc_logging.c:152:33: error: 'struct gc_logging' has no member named 'rusage'
gc_logging.c: In function 'out_rusage':
gc_logging.c:243:60: error: 'struct gc_logging' has no member named 'rusage'
gc_logging.c:244:60: error: 'struct gc_logging' has no member named 'rusage'
gc_logging.c: At top level:
gc_logging.c:239:1: warning: 'out_rusage' defined but not used [-Wunused-function]
make: *** [gc_logging.o] Error 1
make failed, exit code 2
I'm not seeing any custom events showing up in the logfile.
In your test specs there's also clearly an issue where you only assert the format of the custom event line, you don't assert that there must be a line present which is a custom event:
gc_tracer/spec/gc_tracer_spec.rb
Lines 93 to 95 in 01aa824
If no line matches /out/ then your specs will still pass.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.