Bug #8000
closed"require 'tk'" segfaults on 64-bit linux with Tk 8.6
Added by edmccard (Ed McCardell) almost 12 years ago. Updated over 9 years ago.
Description
Using ruby 1.9.3p392 and Tk 8.6.0 on 64-bit Arch Linux, attempting to "require 'tk'" causes a segfault.
To reproduce:
ruby -e "require 'tk'"
The crash log is in the attached file.
Notes:
- I've heard from a Gentoo user who is having the same problem.
- On 32-bit Arch Linux, there is no problem.
Files
crash.log (16.2 KB) crash.log | edmccard (Ed McCardell), 03/02/2013 02:43 PM | ||
bt.txt (1.82 KB) bt.txt | ponimas (Alexander Ponimaskin), 03/06/2013 04:25 AM | ||
bt-debug.txt (4.47 KB) bt-debug.txt | edmccard (Ed McCardell), 03/08/2013 05:55 PM | ||
crash-2.txt (4.49 KB) crash-2.txt | edmccard (Ed McCardell), 03/19/2013 03:04 PM | ||
0001-Fix-tk-crash-with-Tk-8.6.1-on-Ubuntu.patch (2.36 KB) 0001-Fix-tk-crash-with-Tk-8.6.1-on-Ubuntu.patch | h.shirosaki (Hiroshi Shirosaki), 08/07/2014 07:47 AM | ||
tk-diff-ruby-1.9.3-p547 (17.8 KB) tk-diff-ruby-1.9.3-p547 | Tcl/Tk8.6 support for Ruby1.9.3p547 | nagai (Hidetoshi Nagai), 10/19/2014 12:53 PM | |
tk-diff-ruby-2.0.0-p576 (17.6 KB) tk-diff-ruby-2.0.0-p576 | Tcl/Tk8.6 support for Ruby2.0.0p576 | nagai (Hidetoshi Nagai), 10/19/2014 12:53 PM | |
tk-diff-ruby-2.1.3-p242 (17.2 KB) tk-diff-ruby-2.1.3-p242 | Tcl/Tk8.6 support for Ruby 2.1.3p242 | nagai (Hidetoshi Nagai), 10/19/2014 12:53 PM |
Updated by jonforums (Jon Forums) almost 12 years ago
Did you build tcltk, or install binaries via pacman? This seems wacky if you used pacman, but does file
prove /usr/lib/libtcl8.6.so and /usr/lib/libtk8.6.so are 64bit?
Since it crashes so easily, fire up gdb via something like
gdb --args ruby -e "require 'tk'"
run it, and attach the backtrace.
Updated by ponimas (Alexander Ponimaskin) almost 12 years ago
All packages are installed via packman
/usr/lib/libtcl8.6.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0x31a66c5d6eacb77f2a9a220bff2e78a88821167e, not stripped
/usr/lib/libtk8.6.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0xdfa2df7ef1e30e3fbe510a294f8fe781415ee964, not stripped
Updated by jonforums (Jon Forums) almost 12 years ago
One of the committers please assign this to Hidetoshi NAGAI.
Too bad tcltklib.so is stripped and the bt is weak. I bet no one on ruby-core has an Arch x64 system to try to repro/debug the issue, so we need to get better debug info. (Or reproduce it on a Ubuntu x64 system)
Are you able to build ruby? If you did a pacman install of Arch's ruby 1.9.3_p392 package, you should be able to build from source, and tweak configure
's optflags
and debugflags
to build tcltklib.so with debug info. The default install is to /usr/local
so your Arch pkg won't get clobbered if you don't use --prefix
.
My Arch x64 system is cmd line only. When I tried to cheat a repro/debug by installing tcl/tk add it's 15 friends, ruby -e "require 'tk'"
rightfully failed due to no display. I don't know whether it failed before or after your segv. When I get time, I'll standup a new ArchBang install and try again. It looks as if tcltklib.so could be passing a bad value into the tcl library. Hard to tell from the bt.
Before you try building from source have you pinged the Arch Forum? I'd skimmed posts on Newbie Corner and Installation and didn't see mention of this issue. Have you contacted Arch's ruby packager (Thomas Dziedzic) to confirm whether he's seeing the issue? Given it fails so quickly, I was surprised not to find it in the forums.
Then again, Nagai-san may soon see this issue and swoop in with the solution ;)
Updated by nagai (Hidetoshi Nagai) almost 12 years ago
First of all, current Ruby/Tk cannot support Tcl/Tk8.6. Please see [ruby-talk:395829].
But, I don't know whether this trouble belongs to the "tailcall" problem or not.
Does the same trouble occur with Tcl/Tk8.5 ? If so, tcltklib may not follow the changes on Ruby's core.
Of course, I must fix this bug and should support Tcl/Tk8.6.
However, I don't have enough time to work on it,
and unfortunately I have no idea to avoid the "tailcall" problem now.
Updated by edmccard (Ed McCardell) almost 12 years ago
Jon: I've just posted to Newbie Corner on the Arch forums. The only other place on the internet that I've seen this is in the forums for the Coursera Programming languages class I'm taking, where several other users have reported it. I'll build ruby/tcl/tk from source tonight with debug info and get a better trace.
Nagai-san: Using the latest version of Arch linux ruby that was built against Tcl/Tk 8.5 works fine (that's ruby 1.9.3 p127). I don't know about the tailcall problem, but on 32-bit Arch linux with Tcl/Tk 8.6, the ruby/tk scripts I run are working without segfault.
Updated by edmccard (Ed McCardell) almost 12 years ago
- File bt-debug.txt bt-debug.txt added
Now that I've tried a few more ruby/tk scripts, I see that only a limited subset of tk works on 32-bit under Tk8.6. But in case it's still useful, I've attached a backtrace from gdb using ruby1.9.3p392/tcl8.6/tk8.6 with debug info on 64-bit.
Updated by jonforums (Jon Forums) almost 12 years ago
First of all, current Ruby/Tk cannot support Tcl/Tk8.6. Please see [ruby-talk:395829].
But, I don't know whether this trouble belongs to the "tailcall" problem or not.
Nagai-san: thanks for the info. FYI, while it's not really relevant to Ed's Arch issue, I'm running Tcl/Tk8.6 on Win7 32bit on ruby 1.9.3p393
and ruby 2.0.0p19
built with mingw-w64 4.7.2 and I've not yet seen any problems with test scripts like http://pastie.org/6420781
Updated by nagai (Hidetoshi Nagai) almost 12 years ago
Could you test the following script?¶
module TkCore; RUN_EVENTLOOP_ON_MAIN_THREAD = true; end
require 'tk'
Tk.mainloop
If it works, a bug may exist on handling a Thread.
From: "edmccard (Ed McCardell)" edmccard@hotmail.com
Subject: [ruby-core:53226] [ruby-trunk - Bug #8000] "require 'tk'" segfaults on 64-bit linux with Tk 8.6
Date: Fri, 8 Mar 2013 17:55:30 +0900
Message-ID: redmine.journal-37386.20130308175529@ruby-lang.org
Issue #8000 has been updated by edmccard (Ed McCardell).
File bt-debug.txt added
Now that I've tried a few more ruby/tk scripts, I see that only a limited subset of tk works on 32-bit under Tk8.6. But in case it's still useful, I've attached a backtrace from gdb using ruby1.9.3p392/tcl8.6/tk8.6 with debug info on 64-bit.¶
Bug #8000: "require 'tk'" segfaults on 64-bit linux with Tk 8.6
https://bugs.ruby-lang.org/issues/8000#change-37386Author: edmccard (Ed McCardell)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]Using ruby 1.9.3p392 and Tk 8.6.0 on 64-bit Arch Linux, attempting to "require 'tk'" causes a segfault.
To reproduce:
ruby -e "require 'tk'"The crash log is in the attached file.
Notes:
- I've heard from a Gentoo user who is having the same problem.
- On 32-bit Arch Linux, there is no problem.
Updated by edmccard (Ed McCardell) almost 12 years ago
That script,¶
module TkCore; RUN_EVENTLOOP_ON_MAIN_THREAD = true; end
require 'tk'
Tk.mainloop
gives the result:
called Tcl_FindHashEntry on deleted table
Aborted (core dumped)
The same thing happens if the final line is commented out.
Updated by hsbt (Hiroshi SHIBATA) almost 12 years ago
- Assignee set to nagai (Hidetoshi Nagai)
Updated by edmccard (Ed McCardell) almost 12 years ago
- File crash-2.txt crash-2.txt added
Attached is the gdb backtrace from running nagai's test script.
Updated by nagai (Hidetoshi Nagai) over 11 years ago
Currently, Ruby/Tk cannot support Tcl/Tk8.6. Please use Tcl/Tk8.5.
I want to add Tcl/Tk8.6 to supported version. But it is a future work.
Updated by vo.x (Vit Ondruch) over 10 years ago
Fedora has accepted Tcl/Tk 8.6 for F21 [1]. Is there any chance this will get resolved? Is there any repository with adjustments for 8.6 compatibility? Is there something I can help (having just limited knowledge)?
Updated by h.shirosaki (Hiroshi Shirosaki) over 10 years ago
- File 0001-Fix-tk-crash-with-Tk-8.6.1-on-Ubuntu.patch 0001-Fix-tk-crash-with-Tk-8.6.1-on-Ubuntu.patch added
I see the crash with ruby trunk and Tk 8.6.1 on Ubuntu Linux x86_64.
It seems calling __orig_namespace_command__
causes access violation. objClientData
memory looks freed.
Instead using rename
command to create __orig_namespace_command__
works without crash.
I tested it with some files in ext/tk/sample.
I attached a patch.
Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago
- Status changed from Open to Assigned
Updated by codebykevin (Kevin Walzer) about 10 years ago
If this patch fixes the crash on Ubuntu, can it be generalized to support Ti 8.6 across platforms? Tk 8.5 is going to be EOL'ed at some point soon and it is very important that Ruby work with 8.6.
Updated by codebykevin (Kevin Walzer) about 10 years ago
To generalize further, is it even necessary to do platform tests? Could the simple change:
-
Tcl_Eval(interp, "rename namespace orig_namespace_command");
Tcl_CreateObjCommand(interp, "namespace", ip_rbNamespaceObjCmd,
(ClientData) 0, (Tcl_CmdDeleteProc *)NULL);
be applied to implement 8.6 support across the board?
Updated by nagai (Hidetoshi Nagai) about 10 years ago
- File tk-diff-ruby-2.0.0-p576 tk-diff-ruby-2.0.0-p576 added
- File tk-diff-ruby-2.1.3-p242 tk-diff-ruby-2.1.3-p242 added
- Status changed from Assigned to Closed
- File tk-diff-ruby-1.9.3-p547 tk-diff-ruby-1.9.3-p547 added
Please apply the attached patch.
Updated by usa (Usaku NAKAMURA) about 10 years ago
Hidetoshi Nagai wrote:
Please apply the attached patch.
I guess that these patches are corresponding to r48018 in trunk.
However, they contain not only the fix of the SEGV but also many new features, aren't they?
Unless there is a very compelling reason, it is not possible to add new features to the branch in the maintenance phase.
Could you make the patches contain only the fix of the SEGV?
(It should be noted that the ordinal maintenance phase of ruby_1_9_3
branch has been already ended, then ordinal bug fixes will not be backported, only security issues will be.)
Updated by usa (Usaku NAKAMURA) about 10 years ago
- Related to Backport #10400: Ruby/Tk patch for Tcl/Tk8.6 added
Updated by usa (Usaku NAKAMURA) about 10 years ago
- Related to Backport #10399: Ruby/Tk patch for Tcl/Tk8.6 added
Updated by usa (Usaku NAKAMURA) about 10 years ago
- Related to Backport #10401: Ruby/Tk patch for Tcl/Tk8.6 added
Updated by usa (Usaku NAKAMURA) about 10 years ago
- Backport set to 2.0.0: REQUIRED, 2.1: REQUIRED
Updated by vo.x (Vit Ondruch) over 9 years ago
- Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE