Overview
| Artifact ID: | 00aac11cbec1986f7bd0c3c74f92cec027bc1a84 |
|---|---|
| Ticket: | f23d040b9b1a0894a70b5bb45632c7d5f33ccdeb
application hangs in TclInitNotifier using TCL 8.5.19 on windows |
| User & Date: | markf78 on 2016-08-23 18:45:34 |
Changes
- icomment:
@apnadkarni Sorry my previous comment was confusing. Test 1. Using the tcl85t.dll and I was able to reproduce the deadlock. Test 2. I then rebuild using debug symbols (so using the tcl85tg.dll) and again I reproduced the deadlock. In Visual Studio, i pushed pause to view the system stack and it was again stuck in the same loop which I provided earlier. Using this puase technique consistently yields the same result. Test 3. Upgraded the tcl source code to TCL 8.6.6. Built using: nmake -f makefile.vc OPTS=msvcrt MSVCDIR=IDE TMP_DIR=$(Platform)\$(Configuration) OUT_DIR=$(Platform)\$(Configuration) So far, I cannot reproduce the problem. I will have our internal QA team continue to attempt to reproduce and I will then report my findings here. Notes. 1. I'm not using Tcl_FindExecutable. 2. Here's my C# wrapper to the native tcl code: using System; using System.Runtime.InteropServices; namespace MyNamespace { public class TCL { #if DEBUG const string tcldll = "tcl85tg.DLL"; #else const string tcldll = "tcl85t.DLL"; #endif [DllImport(tcldll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] private static extern IntPtr Tcl_CreateInterp(); [DllImport(tcldll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] private static extern int Tcl_Init(IntPtr interp); [DllImport(tcldll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] private static extern IntPtr Tcl_GetObjResult(IntPtr interp); [DllImport(tcldll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] private static extern IntPtr Tcl_GetStringFromObj(IntPtr tclObj, IntPtr length); [DllImport(tcldll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] private static extern IntPtr Tcl_SetVar(IntPtr interp, string varName, string newValue, int flags); [DllImport(tcldll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] private static extern int Tcl_EvalFile(IntPtr interp, string filename); [DllImport(tcldll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] private static extern IntPtr Tcl_DeleteInterp(IntPtr interp); private IntPtr m_interp; private string m_tclLibrary; const int TCL_OK = 0; const int TCL_ERROR = 1; private string GetErrorMessage() { IntPtr obj = Tcl_GetObjResult(m_interp); if (obj == IntPtr.Zero) { return string.Empty; } else { IntPtr ptr = Tcl_GetStringFromObj(obj, IntPtr.Zero); return Marshal.PtrToStringAnsi(ptr); } } public TCL(string pathToTCL) { m_tclLibrary = pathToTCL; m_interp = Tcl_CreateInterp(); if (m_interp == IntPtr.Zero) { throw new SystemException("Can not initialize Tcl interpreter"); } } public bool InitInterpreter(out string errmsg) { errmsg = string.Empty; // set the location of the init.tcl file SetVar("tcl_library", m_tclLibrary); // attempt to init tcl i.e. evaluate the init.tcl script int result = Tcl_Init(m_interp); errmsg = (result == TCL_ERROR) ? GetErrorMessage() : string.Empty; return result == TCL_OK; } public void DeleteInterpreter() { m_interp = Tcl_DeleteInterp(m_interp); } public IntPtr SetVar(string varName, string newValue) { return Tcl_SetVar(m_interp, varName, newValue, 0); } public bool EvalFile(string filename, out string errmsg) { int result = Tcl_EvalFile(m_interp, filename); errmsg = (result == TCL_ERROR) ? GetErrorMessage() : string.Empty; return result == TCL_OK; } } } 3. My application code is essentially: void functionCalledOften(string pathToTcl) { TCL tcl = new TCL(pathToTcl); bool tclResult = tcl.InitInterpreter(out errmsg); if (tclResult) { // lots of tcl.SetVar's SetTclVariables(tcl, OutputFile); tclResult = tcl.EvalFile(CtrlTcl, out errmsg); if (tclResult) errmsg = string.Empty; tcl.DeleteInterpreter(); } } - login: "markf78"
- mimetype: "text/plain"