Tcl bug: unexpected stack trace in "unknown"
Open46f801ea5a25e2885588864ef2096fff09edd08aCreated 9 years agoUpdated 9 years ago
Descriptionplain2017-06-06 18:34:56
Unsure how to reproduce outside of my application (trying to port from 8.4 to 8.6). I tried, but cannot. So I'm providing the errorInfo and errorCode that result from this problem. It *appears* to be related to a call through incr Tcl, and perhaps *its* unknown method, which calls ::tailcall, and maybe that messes up the expected call stack.
errorInfo:
Tcl bug: unexpected stack trace in "unknown"
while executing
"error "Tcl bug: unexpected stack trace in \"unknown\"" {} [list CORE UNKNOWN BADTRACE $einfo $expect $errInfo]"
(procedure "::unknown" line 92)
invoked from within
"CConsoleMainWindow $m_consoleMainWindow $this"
while constructing object "::CConsoleApp::cConsoleApp0" in ::CConsoleApp::constructor (body line 28)
invoked from within
"::itcl::parser::handleClass CConsoleApp ::CConsoleApp #auto"
invoked from within
"CConsoleApp #auto"
(object "::CCmdCalConsoleStartup::cCmdCalConsoleStartup0" method "::CCmdCalConsoleStartup::Execute" body line 4)
invoked from within
"::CConsoleApp::Create"
(object "::CCmdCalConsoleStartup::cCmdCalConsoleStartup0" method "::CCmdCalConsoleStartup::Execute" body line 6)
invoked from within
"$cmdConsoleStartup Execute"
(procedure "rve_OpenSpiceFile" line 8)
invoked from within
"rve_OpenSpiceFile $arg1 1 $spiceTopCell"
(procedure "rve_startup" line 36)
invoked from within
"rve_startup"
errorCode:
CORE UNKNOWN BADTRACE {
(while configuring option "-iconclosebtn" for widget "::.m_consoleMainWindow.m_mainPaneManager.m_termPaneFrame")
invoked from within
"::itcl::builtin::Archetype configure $option {*}$args"
(object "::.m_consoleMainWindow.m_mainPaneManager.m_termPaneFrame" method "::itk::Archetype::configure" body line 2)
invoked from within
"$paneFrame configure -background [option get . mutedBackground MutedBackground] -activebackground [option get . selectBackground SelectBackground] ..."
(object "::CConsoleApp::.m_consoleMainWindow" method "::CConsoleMainWindow::CreatePaneFrames" body line 18)
invoked from within
"::CPaneFrameHelper::Initialize $m_termPaneFrame"
(object "::CConsoleApp::.m_consoleMainWindow" method "::CConsoleMainWindow::CreatePaneFrames" body line 44)
invoked from within
"$this CreatePaneFrames"
while constructing object "::CConsoleApp::.m_consoleMainWindow" in ::CConsoleMainWindow::constructor (body line 41)
invoked from within
"::itcl::parser::handleC} {
invoked from within
"CConsoleMainWindow .m_consoleMainWindow ::CConsoleApp::cConsoleApp0"
("uplevel" body line 1)
invoked from within
"uplevel 1 $args"} {
(while configuring option "-iconclosebtn" for widget "::.m_consoleMainWindow.m_mainPaneManager.m_termPaneFrame")
invoked from within
"::itcl::builtin::Archetype configure $option {*}$args"
(object "::.m_consoleMainWindow.m_mainPaneManager.m_termPaneFrame" method "::itk::Archetype::configure" body line 2)
invoked from within
"$paneFrame configure -background [option get . mutedBackground MutedBackground] -activebackground [option get . selectBackground SelectBackground] ..."
(object "::CConsoleApp::.m_consoleMainWindow" method "::CConsoleMainWindow::CreatePaneFrames" body line 18)
invoked from within
"::CPaneFrameHelper::Initialize $m_termPaneFrame"
(object "::CConsoleApp::.m_consoleMainWindow" method "::CConsoleMainWindow::CreatePaneFrames" body line 44)
invoked from within
"$this CreatePaneFrames"
while constructing object "::CConsoleApp::.m_consoleMainWindow" in ::CConsoleMainWindow::constructor (body line 41)
invoked from within
"::itcl::parser::handleClass CConsoleMainWindow ::CConsoleMainWindow .m_consoleMainWindow ::CConsoleApp::cConsoleApp0"
("uplevel" body line 1)
invoked from within
"uplevel 1 $args"}
additionally, the 3 variables mentioned in the unexpected stack trace have the following values:
einfo:
{
(while configuring option "-iconclosebtn" for widget "::.m_consoleMainWindow.m_mainPaneManager.m_termPaneFrame")
invoked from within
"::itcl::builtin::Archetype configure $option {*}$args"
(object "::.m_consoleMainWindow.m_mainPaneManager.m_termPaneFrame" method "::itk::Archetype::configure" body line 2)
invoked from within
"$paneFrame configure -background [option get . mutedBackground MutedBackground] -activebackground [option get . selectBackground SelectBackground] ..."
(object "::CConsoleApp::.m_consoleMainWindow" method "::CConsoleMainWindow::CreatePaneFrames" body line 18)
invoked from within
"::CPaneFrameHelper::Initialize $m_termPaneFrame"
(object "::CConsoleApp::.m_consoleMainWindow" method "::CConsoleMainWindow::CreatePaneFrames" body line 44)
invoked from within
"$this CreatePaneFrames"
while constructing object "::CConsoleApp::.m_consoleMainWindow" in ::CConsoleMainWindow::constructor (body line 41)
invoked from within
"::itcl::parser::handleC}
expect:
{
invoked from within
"CConsoleMainWindow .m_consoleMainWindow ::CConsoleApp::cConsoleApp0"
("uplevel" body line 1)
invoked from within
"uplevel 1 $args"}
errInfo:
{
(while configuring option "-iconclosebtn" for widget "::.m_consoleMainWindow.m_mainPaneManager.m_termPaneFrame")
invoked from within
"::itcl::builtin::Archetype configure $option {*}$args"
(object "::.m_consoleMainWindow.m_mainPaneManager.m_termPaneFrame" method "::itk::Archetype::configure" body line 2)
invoked from within
"$paneFrame configure -background [option get . mutedBackground MutedBackground] -activebackground [option get . selectBackground SelectBackground] ..."
(object "::CConsoleApp::.m_consoleMainWindow" method "::CConsoleMainWindow::CreatePaneFrames" body line 18)
invoked from within
"::CPaneFrameHelper::Initialize $m_termPaneFrame"
(object "::CConsoleApp::.m_consoleMainWindow" method "::CConsoleMainWindow::CreatePaneFrames" body line 44)
invoked from within
"$this CreatePaneFrames"
while constructing object "::CConsoleApp::.m_consoleMainWindow" in ::CConsoleMainWindow::constructor (body line 41)
invoked from within
"::itcl::parser::handleClass CConsoleMainWindow ::CConsoleMainWindow .m_consoleMainWindow ::CConsoleApp::cConsoleApp0"
("uplevel" body line 1)
invoked from within
"uplevel 1 $args"}
there's some truncation going on with the itcl::parser::handleClass
Referenced by1
432f9304f2[46f801ea5a] Make autoloader less fragile when it cannot manufacture a known consistent stack trace. Value inconsistency over failure. check-in2017-06-26 19:18:42
ferrieuxplain2017-06-06 19:37:00
In addition to ::errorInfo, [info errorstack] will give you the actual values passed to each level. That may or may not help.
dgpplain2017-06-06 20:04:00
This will probably be hard to isolate and diagnose. In the meanwhile, you may find a quick workaround is to just stop using the auto-loader.
dgpplain2017-06-23 13:33:05
bigfaceworm had the right idea. The autoloader
doesn't cope with [tailcall] or any other mechanism
where a command can erase itself from the stack trace.
Simplified demo:
% array set auto_index {demo {proc demo {} {tailcall error foo}}}
% demo
Tcl bug: unexpected stack trace in "unknown"
Since Itcl 4 started using [tailcall] in its fundamentals,
this flaw hurts autoloaded Itcl code bad, and that's a bad
habit most Itcl users persist in.
dgpplain2017-06-23 14:21:13
I think there's a related question here regarding whether [tailcall] does "the right thing" with stack traces in the first place. I recall encountering that question before, but I have not yet located any tickets or other notes about it.
dgpplain2017-06-23 16:05:57
Ok, see branches dgp-tailcall-errorinfo and dgp-tailcall-errorinfo-alt. Apparently I ran into related issues back in Dec. 2015.
dgpplain2017-06-23 18:39:59
The question about how [tailcall] should add to -errorinfo arose in the context of working on this Itcl bug. https://sourceforge.net/p/incrtcl/bugs/269/
dgpplain2017-06-26 19:20:27
Committed fix for the worst symptom; failure when unable to achieve perfect stack trace consistency. Better to have an imperfect result than no result at all. Still open questions about how [tailcall] properly should append to -errorinfo.
Log in (anonymous is fine) to add a comment.