Issue #13297 has been updated by Hiroshi SHIBATA.


Applied nobu's suggestion at https://github.com/ruby/tk/pull/7

----------------------------------------
Bug #13297: SIGSEGV on ruby exit after `require 'tk'`
https://bugs.ruby-lang.org/issues/13297#change-63427

* Author: Gray Wolf
* Status: Third Party's Issue
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
I get SIGSEGV when exiting ruby after I required tk. Everything seems to work fine though, crash is only when exiting.

Here is smallest possible script I managed to reproduce issue with:

~~~ ruby
require 'tk'
~~~

I've compiled ruby without -O3 to better output from debugger and this is the result:

~~~ text
$ lldb ./ruby /tmp/test.rb 
(lldb) target create "./ruby"
Current executable set to './ruby' (x86_64).
(lldb) settings set -- target.run-args  "/tmp/test.rb"
(lldb) run
Process 4376 launched: './ruby' (x86_64)
Process 4376 stopped
* thread #3: tid = 4380, 0x00005555556d6072 ruby`vm_call0_body(th=0x0000555555fb0760, calling=0x00007ffff307f0c0, ci=0x00007ffff307f0b0, cc=0x00007ffff307f0e0, argv=0x0000000000000000) + 35 at vm_eval.c:158, name = 'tk.rb:1243', stop reason = signal SIGSEGV: address access protected (fault address: 0x7ffff307eff8)
    frame #0: 0x00005555556d6072 ruby`vm_call0_body(th=0x0000555555fb0760, calling=0x00007ffff307f0c0, ci=0x00007ffff307f0b0, cc=0x00007ffff307f0e0, argv=0x0000000000000000) + 35 at vm_eval.c:158
   155 	{
   156 	    VALUE ret;
   157 	
-> 158 	    calling->block_handler = vm_passed_block_handler(th);
   159 	
   160 	  again:
   161 	    switch (cc->me->def->type) {

~~~

Since it's inside vm_eval.c, does this mean there is some problem with ruby and not with the tk gem? I know basically nothing about ruby insides, so I'm kinda lost as to what should I do to fix this :/

---Files--------------------------------
gdb.txt (562 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>