On Tuesday, September 21, 2021 at 3:48:46 AM UTC+10,
[email protected] wrote:
All the core dumps appear to originate in the new thread, when Tk_Init() is called and the last call from Tk on the stack is from TkpOpenDisplay().
Thanks for helping with this. Which script are you using, the minimal
one with just the [package require Tk] or the original one? If the
simpler one, perhaps running with more threads would make it more consistently fail. Using a VM which is running a lot slower, also seems
to make it fail much more often.
I'm still using the original script. I won't change things just yet.
I've installed Valgrind, and I'm running from the command line not the shell script, and running from the command line I get the following error each and every time. I've pasted two consecutive runs below, there is a slight difference in the amount of
memory Valigrind reports as "definitely lost", but I think that has no bearing on the fault.
I did try Helgrind but it reports many errors. I'll have to look at it more closely.
I haven't use Valigrind before but if I'm reading this correctly, it seems that in the thread, the X11 library is allocating a block:, freeing it, and then accessing it:
scotty@officepc:~/Engineering on server1/Projects, Software/tcltk/Test scripts$ valgrind --num-callers=25 ~/bin/tclsh crash.tcl
==20764== Memcheck, a memory error detector
==20764== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==20764== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==20764== Command: /home/scotty/bin/tclsh crash.tcl
==20764==
==20764== Thread 3:
==20764== Invalid read of size 1
==20764== at 0x4C31F93: strcmp (vg_replace_strmem.c:842)
==20764== by 0x9902F23: _XimUnRegisterIMInstantiateCallback (imInsClbk.c:238)
==20764== by 0x98E9EF2: XUnregisterIMInstantiateCallback (IMWrap.c:200) ==20764== by 0x8E2941C: InstantiateIMCallback (tkUnixEvent.c:681)
==20764== by 0x9902E04: _XimRegisterIMInstantiateCallback (imInsClbk.c:209) ==20764== by 0x98E9E8B: XRegisterIMInstantiateCallback (IMWrap.c:177) ==20764== by 0x8E28AB0: TkpOpenDisplay (tkUnixEvent.c:184)
==20764== by 0x8D4E897: GetScreen (tkWindow.c:465)
==20764== by 0x8D4E634: CreateTopLevelWindow (tkWindow.c:348)
==20764== by 0x8D4F3A6: TkCreateMainWindow (tkWindow.c:854)
==20764== by 0x8D5F1D7: CreateFrame (tkFrame.c:582)
==20764== by 0x8D5ECB7: TkListCreateFrame (tkFrame.c:468)
==20764== by 0x8D53014: Initialize (tkWindow.c:3254)
==20764== by 0x8D521A2: Tk_Init (tkWindow.c:2914)
==20764== by 0x4FBDE34: Tcl_LoadObjCmd (tclLoad.c:464)
==20764== by 0x4E840B1: Dispatch (tclBasic.c:4426)
==20764== by 0x4E8413E: TclNRRunCallbacks (tclBasic.c:4461)
==20764== by 0x4E8396B: Tcl_EvalObjv (tclBasic.c:4189)
==20764== by 0x4E85F3A: TclEvalEx (tclBasic.c:5330)
==20764== by 0x4E85268: Tcl_EvalEx (tclBasic.c:4995)
==20764== by 0x76B7C2F: NewThread (threadCmd.c:1858)
==20764== by 0x4F557B2: NewThreadProc (tclEvent.c:1568)
==20764== by 0x5A7D6B9: start_thread (pthread_create.c:333)
==20764== Address 0xa7e8ea0 is 0 bytes inside a block of size 1 free'd ==20764== at 0x4C2EDEB: free (vg_replace_malloc.c:530)
==20764== by 0x98F905C: XSetLocaleModifiers (lcWrap.c:89)
==20764== by 0x8E294BF: OpenIM (tkUnixEvent.c:725)
==20764== by 0x8E28A84: TkpOpenDisplay (tkUnixEvent.c:183)
==20764== by 0x8D4E897: GetScreen (tkWindow.c:465)
==20764== by 0x8D4E634: CreateTopLevelWindow (tkWindow.c:348)
==20764== by 0x8D4F3A6: TkCreateMainWindow (tkWindow.c:854)
==20764== by 0x8D5F1D7: CreateFrame (tkFrame.c:582)
==20764== by 0x8D5ECB7: TkListCreateFrame (tkFrame.c:468)
==20764== by 0x8D53014: Initialize (tkWindow.c:3254)
==20764== by 0x8D521A2: Tk_Init (tkWindow.c:2914)
==20764== by 0x4FBDE34: Tcl_LoadObjCmd (tclLoad.c:464)
==20764== by 0x4E840B1: Dispatch (tclBasic.c:4426)
==20764== by 0x4E8413E: TclNRRunCallbacks (tclBasic.c:4461)
==20764== by 0x4E8396B: Tcl_EvalObjv (tclBasic.c:4189)
==20764== by 0x4E85F3A: TclEvalEx (tclBasic.c:5330)
==20764== by 0x4E85268: Tcl_EvalEx (tclBasic.c:4995)
==20764== by 0x76B7C2F: NewThread (threadCmd.c:1858)
==20764== by 0x4F557B2: NewThreadProc (tclEvent.c:1568)
==20764== by 0x5A7D6B9: start_thread (pthread_create.c:333)
==20764== Block was alloc'd at
==20764== at 0x4C2DB8F: malloc (vg_replace_malloc.c:299)
==20764== by 0x98F8C77: _XlcDefaultMapModifiers (lcWrap.c:146)
==20764== by 0x98F9045: XSetLocaleModifiers (lcWrap.c:87)
==20764== by 0x8E294BF: OpenIM (tkUnixEvent.c:725)
==20764== by 0x8E28A84: TkpOpenDisplay (tkUnixEvent.c:183)
==20764== by 0x8D4E897: GetScreen (tkWindow.c:465)
==20764== by 0x8D4E634: CreateTopLevelWindow (tkWindow.c:348)
==20764== by 0x8D4F3A6: TkCreateMainWindow (tkWindow.c:854)
==20764== by 0x8D5F1D7: CreateFrame (tkFrame.c:582)
==20764== by 0x8D5ECB7: TkListCreateFrame (tkFrame.c:468)
==20764== by 0x8D53014: Initialize (tkWindow.c:3254)
==20764== by 0x8D521A2: Tk_Init (tkWindow.c:2914)
==20764== by 0x4FBDE34: Tcl_LoadObjCmd (tclLoad.c:464)
==20764== by 0x4E840B1: Dispatch (tclBasic.c:4426)
==20764== by 0x4E8413E: TclNRRunCallbacks (tclBasic.c:4461)
==20764== by 0x4E8396B: Tcl_EvalObjv (tclBasic.c:4189)
==20764== by 0x4E85F3A: TclEvalEx (tclBasic.c:5330)
==20764== by 0x4E85268: Tcl_EvalEx (tclBasic.c:4995)
==20764== by 0x76B7C2F: NewThread (threadCmd.c:1858)
==20764== by 0x4F557B2: NewThreadProc (tclEvent.c:1568)
==20764== by 0x5A7D6B9: start_thread (pthread_create.c:333)
==20764==
done
==20764==
==20764== HEAP SUMMARY:
==20764== in use at exit: 6,205,834 bytes in 27,707 blocks
==20764== total heap usage: 225,668 allocs, 197,961 frees, 37,953,711 bytes allocated
==20764==
==20764== LEAK SUMMARY:
==20764== definitely lost: 816 bytes in 2 blocks
==20764== indirectly lost: 0 bytes in 0 blocks
==20764== possibly lost: 816 bytes in 3 blocks
==20764== still reachable: 6,204,202 bytes in 27,702 blocks
==20764== suppressed: 0 bytes in 0 blocks
==20764== Rerun with --leak-check=full to see details of leaked memory ==20764==
==20764== For counts of detected and suppressed errors, rerun with: -v ==20764== ERROR SUMMARY: 3 errors from 1 contexts (suppressed: 0 from 0) scotty@officepc:~/Engineering on server1/Projects, Software/tcltk/Test scripts$
scotty@officepc:~/Engineering on server1/Projects, Software/tcltk/Test scripts$ valgrind --num-callers=25 ~/bin/tclsh crash.tcl
==23167== Memcheck, a memory error detector
==23167== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==23167== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==23167== Command: /home/scotty/bin/tclsh crash.tcl
==23167==
==23167== Thread 2:
==23167== Invalid read of size 1
==23167== at 0x4C31F93: strcmp (vg_replace_strmem.c:842)
==23167== by 0xA903F23: _XimUnRegisterIMInstantiateCallback (imInsClbk.c:238)
==23167== by 0xA8EAEF2: XUnregisterIMInstantiateCallback (IMWrap.c:200) ==23167== by 0xA62B41C: InstantiateIMCallback (tkUnixEvent.c:681)
==23167== by 0xA903E04: _XimRegisterIMInstantiateCallback (imInsClbk.c:209) ==23167== by 0xA8EAE8B: XRegisterIMInstantiateCallback (IMWrap.c:177) ==23167== by 0xA62AAB0: TkpOpenDisplay (tkUnixEvent.c:184)
==23167== by 0xA550897: GetScreen (tkWindow.c:465)
==23167== by 0xA550634: CreateTopLevelWindow (tkWindow.c:348)
==23167== by 0xA5513A6: TkCreateMainWindow (tkWindow.c:854)
==23167== by 0xA5611D7: CreateFrame (tkFrame.c:582)
==23167== by 0xA560CB7: TkListCreateFrame (tkFrame.c:468)
==23167== by 0xA555014: Initialize (tkWindow.c:3254)
==23167== by 0xA5541A2: Tk_Init (tkWindow.c:2914)
==23167== by 0x4FBDE34: Tcl_LoadObjCmd (tclLoad.c:464)
==23167== by 0x4E840B1: Dispatch (tclBasic.c:4426)
==23167== by 0x4E8413E: TclNRRunCallbacks (tclBasic.c:4461)
==23167== by 0x4E8396B: Tcl_EvalObjv (tclBasic.c:4189)
==23167== by 0x4E85F3A: TclEvalEx (tclBasic.c:5330)
==23167== by 0x4E85268: Tcl_EvalEx (tclBasic.c:4995)
==23167== by 0x76B7C2F: NewThread (threadCmd.c:1858)
==23167== by 0x4F557B2: NewThreadProc (tclEvent.c:1568)
==23167== by 0x5A7D6B9: start_thread (pthread_create.c:333)
==23167== Address 0x9cbdd70 is 0 bytes inside a block of size 1 free'd ==23167== at 0x4C2EDEB: free (vg_replace_malloc.c:530)
==23167== by 0xA8FA05C: XSetLocaleModifiers (lcWrap.c:89)
==23167== by 0xA62B4BF: OpenIM (tkUnixEvent.c:725)
==23167== by 0xA62B3F0: InstantiateIMCallback (tkUnixEvent.c:680)
==23167== by 0xA903E04: _XimRegisterIMInstantiateCallback (imInsClbk.c:209) ==23167== by 0xA8EAE8B: XRegisterIMInstantiateCallback (IMWrap.c:177) ==23167== by 0xA62AAB0: TkpOpenDisplay (tkUnixEvent.c:184)
==23167== by 0xA550897: GetScreen (tkWindow.c:465)
==23167== by 0xA550634: CreateTopLevelWindow (tkWindow.c:348)
==23167== by 0xA5513A6: TkCreateMainWindow (tkWindow.c:854)
==23167== by 0xA5611D7: CreateFrame (tkFrame.c:582)
==23167== by 0xA560CB7: TkListCreateFrame (tkFrame.c:468)
==23167== by 0xA555014: Initialize (tkWindow.c:3254)
==23167== by 0xA5541A2: Tk_Init (tkWindow.c:2914)
==23167== by 0x4FBDE34: Tcl_LoadObjCmd (tclLoad.c:464)
==23167== by 0x4E840B1: Dispatch (tclBasic.c:4426)
==23167== by 0x4E8413E: TclNRRunCallbacks (tclBasic.c:4461)
==23167== by 0x4E8396B: Tcl_EvalObjv (tclBasic.c:4189)
==23167== by 0x4E85F3A: TclEvalEx (tclBasic.c:5330)
==23167== by 0x4E85268: Tcl_EvalEx (tclBasic.c:4995)
==23167== by 0x76B7C2F: NewThread (threadCmd.c:1858)
==23167== by 0x4F557B2: NewThreadProc (tclEvent.c:1568)
==23167== by 0x5A7D6B9: start_thread (pthread_create.c:333)
==23167== Block was alloc'd at
==23167== at 0x4C2DB8F: malloc (vg_replace_malloc.c:299)
==23167== by 0xA8F9C77: _XlcDefaultMapModifiers (lcWrap.c:146)
==23167== by 0xA8FA045: XSetLocaleModifiers (lcWrap.c:87)
==23167== by 0xA62B4BF: OpenIM (tkUnixEvent.c:725)
==23167== by 0xA62AA84: TkpOpenDisplay (tkUnixEvent.c:183)
==23167== by 0xA550897: GetScreen (tkWindow.c:465)
==23167== by 0xA550634: CreateTopLevelWindow (tkWindow.c:348)
==23167== by 0xA5513A6: TkCreateMainWindow (tkWindow.c:854)
==23167== by 0xA5611D7: CreateFrame (tkFrame.c:582)
==23167== by 0xA560CB7: TkListCreateFrame (tkFrame.c:468)
==23167== by 0xA555014: Initialize (tkWindow.c:3254)
==23167== by 0xA5541A2: Tk_Init (tkWindow.c:2914)
==23167== by 0x4FBDE34: Tcl_LoadObjCmd (tclLoad.c:464)
==23167== by 0x4E840B1: Dispatch (tclBasic.c:4426)
==23167== by 0x4E8413E: TclNRRunCallbacks (tclBasic.c:4461)
==23167== by 0x4E8396B: Tcl_EvalObjv (tclBasic.c:4189)
==23167== by 0x4E85F3A: TclEvalEx (tclBasic.c:5330)
==23167== by 0x4E85268: Tcl_EvalEx (tclBasic.c:4995)
==23167== by 0x76B7C2F: NewThread (threadCmd.c:1858)
==23167== by 0x4F557B2: NewThreadProc (tclEvent.c:1568)
==23167== by 0x5A7D6B9: start_thread (pthread_create.c:333)
==23167==
done
==23167==
==23167== HEAP SUMMARY:
==23167== in use at exit: 6,705,219 bytes in 34,323 blocks
==23167== total heap usage: 230,006 allocs, 195,683 frees, 37,377,289 bytes allocated
==23167==
==23167== LEAK SUMMARY:
==23167== definitely lost: 408 bytes in 1 blocks
==23167== indirectly lost: 0 bytes in 0 blocks
==23167== possibly lost: 816 bytes in 3 blocks
==23167== still reachable: 6,703,995 bytes in 34,319 blocks
==23167== suppressed: 0 bytes in 0 blocks
==23167== Rerun with --leak-check=full to see details of leaked memory ==23167==
==23167== For counts of detected and suppressed errors, rerun with: -v ==23167== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) scotty@officepc:~/Engineering on server1/Projects, Software/tcltk/Test scripts$
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)