Skip to content

Instantly share code, notes, and snippets.

@libc
Created April 17, 2015 08:15
Show Gist options
  • Save libc/298b3b6ff6930d545af6 to your computer and use it in GitHub Desktop.
Save libc/298b3b6ff6930d545af6 to your computer and use it in GitHub Desktop.
➜ 7657854f371edcb5d8e6 git:(master) ✗ AWS_REGION=eu-west-1 lldb -- /tmp/ruby/bin/ruby sqs_leak_test.rb
(lldb) target create "/tmp/ruby/bin/ruby"
Current executable set to '/tmp/ruby/bin/ruby' (x86_64).
(lldb) settings set -- target.run-args "sqs_leak_test.rb"
(lldb) run
Process 52512 launched: '/tmp/ruby/bin/ruby' (x86_64)
32.28515625
33.08984375
33.16796875
Process 52512 stopped
* thread #1: tid = 0x5bf30b, 0x000000010009fbef ruby`RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET(objspace=0x0000000100509300, page=0x0000000101a604e0, obj=4305613160) + 31 at gc.c:1103, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x000000010009fbef ruby`RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET(objspace=0x0000000100509300, page=0x0000000101a604e0, obj=4305613160) + 31 at gc.c:1103
1100 static inline void
1101 RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET(rb_objspace_t *objspace, struct heap_page *page, VALUE obj)
1102 {
-> 1103 MARK_IN_BITMAP(&page->uncollectible_bits[0], obj);
1104 objspace->rgengc.old_objects++;
1105
1106 #if RGENGC_PROFILE >= 2
(lldb) break strio_write
invalid command 'breakpoint strio_write'
(lldb) breakpoint stringio.c 1164
error: command 'breakpoint' did not recognize 'stringio .c' as valid (subcommand might be invalid).
(lldb) file stringio.c
error: unable to find executable for 'stringio.c'
(lldb) source stringio.c
error: command 'source' did not recognize 'stringio .c' as valid (subcommand might be invalid).
(lldb) source
The following subcommands are supported:
list -- Display source code (as specified) based on the current executable's debug info.
For more help on any particular subcommand, type 'help <command> <subcommand>'.
(lldb) source list
1107 objspace->profile.total_promoted_count++;
1108 objspace->profile.promoted_types[BUILTIN_TYPE(obj)]++;
1109 #endif
1110 }
1111
1112 static inline void
1113 RVALUE_OLD_UNCOLLECTIBLE_SET(rb_objspace_t *objspace, VALUE obj)
(lldb) breakpoint set --file stringio.c --line 1164
Breakpoint 1: where = stringio.bundle`strio_write + 19 at stringio.c:1166, address = 0x0000000101f86853
(lldb) cont
Process 52512 resuming
33.375
Process 52512 stopped
* thread #1: tid = 0x5bf30b, 0x0000000101f86853 stringio.bundle`strio_write(self=4303529120, str=4303492360) + 19 at stringio.c:1166, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000101f86853 stringio.bundle`strio_write(self=4303529120, str=4303492360) + 19 at stringio.c:1166
1163 static VALUE
1164 strio_write(VALUE self, VALUE str)
1165 {
-> 1166 struct StringIO *ptr = writable(self);
1167 long len, olen;
1168 rb_encoding *enc, *enc2;
1169 rb_encoding *const ascii8bit = rb_ascii8bit_encoding();
(lldb) bt
* thread #1: tid = 0x5bf30b, 0x0000000101f86853 stringio.bundle`strio_write(self=4303529120, str=4303492360) + 19 at stringio.c:1166, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
* frame #0: 0x0000000101f86853 stringio.bundle`strio_write(self=4303529120, str=4303492360) + 19 at stringio.c:1166
frame #1: 0x0000000100262caa ruby`call_cfunc_1(func=0x0000000101f86840, recv=4303529120, argc=1, argv=0x00000001006006d0) + 42 at vm_insnhelper.c:1257
frame #2: 0x000000010026889e ruby`vm_call_cfunc_with_frame(th=0x0000000100508f60, reg_cfp=0x00000001006ff100, ci=0x0000000103a41d58) + 1646 at vm_insnhelper.c:1418
frame #3: 0x0000000100266fa5 ruby`vm_call_cfunc(th=0x0000000100508f60, reg_cfp=0x00000001006ff100, ci=0x0000000103a41d58) + 133 at vm_insnhelper.c:1513
frame #4: 0x0000000100241a6e ruby`vm_exec_core(th=0x0000000100508f60, initial=0) + 18446 at insns.def:1075
frame #5: 0x000000010025320f ruby`vm_exec(th=0x0000000100508f60) + 191 at vm.c:1454
frame #6: 0x000000010025a7e1 ruby`invoke_block_from_c(th=0x0000000100508f60, block=0x0000000103888e80, self=4308038720, argc=1, argv=0x00007fff5fbfad30, blockptr=0x0000000000000000, cref=0x0000000000000000, defined_class=4305535040, splattable=0) + 2865 at vm.c:842
frame #7: 0x00000001002525f2 ruby`vm_invoke_proc(th=0x0000000100508f60, proc=0x0000000103888e80, self=4308038720, defined_class=4305535040, argc=1, argv=0x00007fff5fbfad30, blockptr=0x0000000000000000) + 306 at vm.c:907
frame #8: 0x0000000100261251 ruby`vm_call_bmethod_body(th=0x0000000100508f60, ci=0x0000000101a02da0, argv=0x00007fff5fbfad30) + 113 at vm_insnhelper.c:1542
frame #9: 0x00000001002671b5 ruby`vm_call_bmethod(th=0x0000000100508f60, cfp=0x00000001006ffe20, ci=0x0000000101a02da0) + 293 at vm_insnhelper.c:1558
frame #10: 0x0000000100241a6e ruby`vm_exec_core(th=0x0000000100508f60, initial=0) + 18446 at insns.def:1075
frame #11: 0x000000010025320f ruby`vm_exec(th=0x0000000100508f60) + 191 at vm.c:1454
frame #12: 0x000000010025a7e1 ruby`invoke_block_from_c(th=0x0000000100508f60, block=0x00000001006ffee0, self=4304280680, argc=1, argv=0x00007fff5fbfc340, blockptr=0x0000000000000000, cref=0x0000000000000000, defined_class=8, splattable=1) + 2865 at vm.c:842
frame #13: 0x000000010025fe68 ruby`vm_yield(th=0x0000000100508f60, argc=1, argv=0x00007fff5fbfc340) + 104 at vm.c:882
frame #14: 0x000000010024e7d3 ruby`rb_yield_0(argc=1, argv=0x00007fff5fbfc340) + 35 at vm_eval.c:990
frame #15: 0x000000010024e79c ruby`rb_yield(val=1) + 60 at vm_eval.c:1000
frame #16: 0x00000001001461d3 ruby`range_each(range=4305406200) + 275 at range.c:768
frame #17: 0x0000000100262c73 ruby`call_cfunc_0(func=0x00000001001460c0, recv=4305406200, argc=0, argv=0x0000000100600068) + 35 at vm_insnhelper.c:1251
frame #18: 0x000000010026889e ruby`vm_call_cfunc_with_frame(th=0x0000000100508f60, reg_cfp=0x00000001006ffec0, ci=0x0000000101a042f0) + 1646 at vm_insnhelper.c:1418
frame #19: 0x0000000100266fa5 ruby`vm_call_cfunc(th=0x0000000100508f60, reg_cfp=0x00000001006ffec0, ci=0x0000000101a042f0) + 133 at vm_insnhelper.c:1513
frame #20: 0x0000000100241889 ruby`vm_exec_core(th=0x0000000100508f60, initial=0) + 17961 at insns.def:1045
frame #21: 0x000000010025320f ruby`vm_exec(th=0x0000000100508f60) + 191 at vm.c:1454
frame #22: 0x000000010025a7e1 ruby`invoke_block_from_c(th=0x0000000100508f60, block=0x00000001006fff80, self=4304280680, argc=0, argv=0x0000000000000000, blockptr=0x0000000000000000, cref=0x0000000000000000, defined_class=8, splattable=1) + 2865 at vm.c:842
frame #23: 0x000000010025fe68 ruby`vm_yield(th=0x0000000100508f60, argc=0, argv=0x0000000000000000) + 104 at vm.c:882
frame #24: 0x000000010024e7d3 ruby`rb_yield_0(argc=0, argv=0x0000000000000000) + 35 at vm_eval.c:990
frame #25: 0x000000010025ec93 ruby`loop_i + 19 at vm_eval.c:1061
frame #26: 0x000000010006f37a ruby`rb_rescue2(b_proc=0x000000010025ec80, data1=0, r_proc=0x0000000000000000, data2=0) + 522 at eval.c:813
frame #27: 0x0000000100251234 ruby`rb_f_loop(self=4304280680) + 132 at vm_eval.c:1095
frame #28: 0x0000000100262c73 ruby`call_cfunc_0(func=0x00000001002511b0, recv=4304280680, argc=0, argv=0x0000000100600038) + 35 at vm_insnhelper.c:1251
frame #29: 0x000000010026889e ruby`vm_call_cfunc_with_frame(th=0x0000000100508f60, reg_cfp=0x00000001006fff60, ci=0x0000000101a03520) + 1646 at vm_insnhelper.c:1418
frame #30: 0x0000000100266fa5 ruby`vm_call_cfunc(th=0x0000000100508f60, reg_cfp=0x00000001006fff60, ci=0x0000000101a03520) + 133 at vm_insnhelper.c:1513
frame #31: 0x0000000100266603 ruby`vm_call_method(th=0x0000000100508f60, cfp=0x00000001006fff60, ci=0x0000000101a03520) + 259 at vm_insnhelper.c:1729
frame #32: 0x0000000100268ea5 ruby`vm_call_general(th=0x0000000100508f60, reg_cfp=0x00000001006fff60, ci=0x0000000101a03520) + 37 at vm_insnhelper.c:1888
frame #33: 0x0000000100241889 ruby`vm_exec_core(th=0x0000000100508f60, initial=0) + 17961 at insns.def:1045
frame #34: 0x000000010025320f ruby`vm_exec(th=0x0000000100508f60) + 191 at vm.c:1454
frame #35: 0x00000001002543bb ruby`rb_iseq_eval_main(iseqval=4303764760) + 43 at vm.c:1700
frame #36: 0x000000010006e28a ruby`ruby_exec_internal(n=0x0000000100863d18) + 250 at eval.c:257
frame #37: 0x000000010006e181 ruby`ruby_exec_node(n=0x0000000100863d18) + 33 at eval.c:322
frame #38: 0x000000010006e142 ruby`ruby_run_node(n=0x0000000100863d18) + 66 at eval.c:314
frame #39: 0x000000010000174f ruby`main(argc=2, argv=0x00007fff5fbff7f8) + 95 at main.c:36
frame #40: 0x00007fff8cabd5c9 libdyld.dylib`start + 1
frame #41: 0x00007fff8cabd5c9 libdyld.dylib`start + 1
(lldb) p str
(VALUE) $0 = 4303492360
(lldb) p rb_backtrace()
from sqs_leak_test.rb:19:in `<main>'
from sqs_leak_test.rb:19:in `loop'
from sqs_leak_test.rb:20:in `block in <main>'
from sqs_leak_test.rb:20:in `each'
from sqs_leak_test.rb:21:in `block (2 levels) in <main>'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/base.rb:216:in `block (2 levels) in define_operation_methods'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/request.rb:70:in `send_request'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/plugins/response_target.rb:18:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/aws-sdk-core/plugins/response_paging.rb:10:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/plugins/param_conversion.rb:22:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/plugins/raise_response_errors.rb:14:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/plugins/param_validation.rb:22:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/plugins/endpoint.rb:35:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/plugins/restful_bindings.rb:13:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/aws-sdk-core/plugins/user_agent.rb:12:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/aws-sdk-core/query/handler.rb:11:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/aws-sdk-core/plugins/sqs_queue_urls.rb:13:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/aws-sdk-core/plugins/retry_errors.rb:88:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/aws-sdk-core/plugins/request_signer.rb:78:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/aws-sdk-core/xml/error_handler.rb:8:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/plugins/content_length.rb:12:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/net_http/handler.rb:25:in `call'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/net_http/handler.rb:51:in `transmit'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/net_http/handler.rb:75:in `session'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/net_http/connection_pool.rb:108:in `session_for'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/net_http/handler.rb:77:in `block in session'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/net_http/handler.rb:52:in `block in transmit'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/net_http/connection_pool.rb:337:in `request'
from /tmp/gems/gems/newrelic_rpm-3.10.0.279/lib/new_relic/agent/instrumentation/net.rb:23:in `request_with_newrelic_trace'
from /tmp/gems/gems/newrelic_rpm-3.10.0.279/lib/new_relic/agent/cross_app_tracing.rb:48:in `tl_trace_http_request'
from /tmp/gems/gems/newrelic_rpm-3.10.0.279/lib/new_relic/agent/instrumentation/net.rb:26:in `block in request_with_newrelic_trace'
from /tmp/gems/gems/newrelic_rpm-3.10.0.279/lib/new_relic/agent.rb:453:in `disable_all_tracing'
from /tmp/gems/gems/newrelic_rpm-3.10.0.279/lib/new_relic/agent/instrumentation/net.rb:27:in `block (2 levels) in request_with_newrelic_trace'
from /tmp/ruby/lib/ruby/2.3.0/net/http.rb:1393:in `request'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/net_http/patches.rb:36:in `new_transport_request'
from /tmp/ruby/lib/ruby/2.3.0/net/http/response.rb:162:in `reading_body'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/net_http/patches.rb:37:in `block in new_transport_request'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/net_http/handler.rb:58:in `block (2 levels) in transmit'
from /tmp/ruby/lib/ruby/2.3.0/net/http/response.rb:201:in `read_body'
from /tmp/ruby/lib/ruby/2.3.0/net/http/response.rb:279:in `read_body_0'
from /tmp/ruby/lib/ruby/2.3.0/net/http/response.rb:250:in `inflater'
from /tmp/ruby/lib/ruby/2.3.0/net/http/response.rb:289:in `block in read_body_0'
from /tmp/ruby/lib/ruby/2.3.0/net/protocol.rb:107:in `read'
from /tmp/ruby/lib/ruby/2.3.0/net/protocol.rb:401:in `<<'
from /tmp/ruby/lib/ruby/2.3.0/net/protocol.rb:410:in `call_block'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/net_http/handler.rb:59:in `block (3 levels) in transmit'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/http/response.rb:58:in `signal_data'
from /tmp/gems/gems/aws-sdk-core-2.0.29/lib/seahorse/client/http/response.rb:58:in `write'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment