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
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
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
...
$ 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.
The module defined in ext/gc_tracer/gc_tracer.c is GC::Tracer, but in version.rb
is defined as GcTracer
.
compiling gc_logging.c
In file included from /usr/include/ruby-3.3.0/ruby/ruby.h:27,
from gc_logging.c:5:
gc_logging.c: In function ‘Init_gc_tracer_logging’:
/usr/include/ruby-3.3.0/ruby/internal/anyargs.h:338:142: error: passing argument 3 of ‘rb_define_module_function_00’ from incompatible pointer type [-Wincompatible-pointer-types]
338 | #define rb_define_module_function(mod, mid, func, arity) RBIMPL_ANYARGS_DISPATCH_rb_define_module_function((arity), (func))((mod), (mid), (func), (arity))
| ^~~~~~
| |
| VALUE (*)(int, VALUE *, VALUE) {aka long unsigned int (*)(int, long unsigned int *, long unsigned int)}
gc_logging.c:724:5: note: in expansion of macro ‘rb_define_module_function’
724 | rb_define_module_function(mod, "start_logging_", gc_tracer_start_logging, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ruby-3.3.0/ruby/internal/anyargs.h:274:21: note: expected ‘VALUE (*)(VALUE)’ {aka ‘long unsigned int (*)(long unsigned int)’} but argument is of type ‘VALUE (*)(int, VALUE *, VALUE)’ {aka ‘long unsigned int (*)(int, long unsigned int *, long unsigned int)’}
274 | RBIMPL_ANYARGS_DECL(rb_define_module_function, VALUE, const char *)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ruby-3.3.0/ruby/internal/anyargs.h:255:41: note: in definition of macro ‘RBIMPL_ANYARGS_DECL’
255 | RBIMPL_ANYARGS_ATTRSET(sym) static void sym ## _00(__VA_ARGS__, VALUE(*)(VALUE), int); \
| ^~~
At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
make: *** [Makefile:248: gc_logging.o] Error 1
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.
-- 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 }
.
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.