[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-10-27 Thread Terry J. Reedy
Change by Terry J. Reedy : -- pull_requests: +9480 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-10-27 Thread Terry J. Reedy
Terry J. Reedy added the comment: Serhiy, if you now think that we should try to fix _tkinter to actually support non-thread tcl builds, please review the two PRs on this issue. -- ___ Python tracker

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-28 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: Found yet another race condition -- when creating multiple Tk()s. Attached example (loops indefinitely inside Tcl: some internal list becomes circular for some reason). The obvious fix by wrapping Tcl calls with locks in Tkapp_New

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-18 Thread Ivan Pozdeev
Change by Ivan Pozdeev : -- pull_requests: +6627 ___ Python tracker ___ ___

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-17 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: 2nd fix ready. @devteam The issue is fixed completely now, the fix can be merged. Pushed to the same PR, see https://github.com/python/cpython/pull/6444#issuecomment-389844872 why. Used the option "Hold the Tcl lock for the entire

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: Mark, would you review or at least comment on PR 6444? Your comments in msg316669 on #33479 suggest that you have the requisite knowledge. -- nosy: +markroseman ___ Python tracker

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-12 Thread Terry J. Reedy
Terry J. Reedy added the comment: I opened #33479 Document tkinter and threads, as a spinoff of both this issue and #11077, msg183774. -- ___ Python tracker

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-11 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: The 1st PR is ready. I'll continue working on the 2nd one in this ticket, too, if there are no objections. -- ___ Python tracker

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-07 Thread Scott M
Scott M added the comment: 7 years and counting... My need for a fix is long gone, but I'd like to be able to tell the original group I worked with whether it's now safe to use tkinter from threads. It looks like my original guesses were validated and a fix has been

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-07 Thread Scott M
Change by Scott M : -- nosy: +PythonInTheGrass ___ Python tracker ___ ___

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-06 Thread Terry J. Reedy
Terry J. Reedy added the comment: This issue is effectively a re-opening and continuation of #11077. TkinterCrash2(3)-2.py are altered versions of Serhiy's file of the same name on the old issue. (Ivan, you really should have said all this at the beginning of this issue.)

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-03 Thread Ivan Pozdeev
Change by Ivan Pozdeev : Added file: https://bugs.python.org/file47566/0001-build-2.7-with-threaded-Tcl.patch ___ Python tracker ___

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-03 Thread Ivan Pozdeev
Change by Ivan Pozdeev : Added file: https://bugs.python.org/file47565/0001-Build-non-threaded-debug-Tcl.zip ___ Python tracker ___

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: ... Finally, since https://bugs.python.org/issue30916, the 3.x Windows build uses a binary external and needs even more patching to build and link against a debug and/or custom Tcl/Tk (too long to describe, can give a patch). --

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: > Is threaded tcl just a compile switch, as with CPython? Yes. In tcl.vcxproj, tk.vcxproj and tix.vcxproj, there are parameters named like TclOpts that are passed as OPTS arg to the lib's makefiles. For Tcl 8.5, you need to pass

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: > An automated test would need to fail more consistently, without needing to > click. Running faster would also be good (and perhaps increase failure > rate). The the test would be that the file runs in subprocess without an > error

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: Is threaded tcl just a compile switch, as with CPython? -- ___ Python tracker ___

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: You did not say 'never with threaded tcl'. You also claimed that tkinter is so broken, with either threaded or non-threaded tcl/tk, that tkinter should be trashed. Anyway, I like to test things for myself. If 'never with threaded tcl' is

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: > Ivan, as I also said there, it is not clear to me, given your subsequent > comments, what you consider to be the status of the PR. The PR fixes the problem exposed by TkinterCrash2-2.py and TkinterCrash3-2-2.py and only lacks an

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: > I ran TkinterCrash3-2-2.py 15 times on 64-bit Win10, installed x64 3.6.5, > with tk 8.6.8, and experienced no crashes. I wrote in the initial message that this bug only happens with nonthreaded Tcl, regardless of Python version and Tcl

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: Rerunning 2.7, I sometimes get the following almost immediately without clicking [launch]. Exception in thread Thread-1: Traceback (most recent call last): File "C:\Programs\Python27\lib\threading.py", line 801, in __bootstrap_inner

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: As I reported on the pydev thread "bpo-33257: seeking advice & approval on the course of action", Firefox cannot find the string 'thread' in the tkinter chapter of the official doc. Nor in the tkinter.ttk chapter. IDLE does not find it in

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: I reproduced the error on installed 2.7.14, running tk 8.5.18. I ran TkinterCrash3-2-2.py 15 times on 64-bit Win10, installed x64 3.6.5, with tk 8.6.8, and experienced no crashes. I ran it another 10 times with 32-bit repository 3.8 debug

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: > So this issue doesn't occur when linked with a thread-aware Tcl/Tk, right? Maybe we should just make sure that's the only configuration we ensure? This would break compatibility, including some usage patterns (see the "Reuse the

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Guido van Rossum
Guido van Rossum added the comment: So this issue doesn't occur when linked with a thread-aware Tcl/Tk, right? Maybe we should just make sure that's the only configuration we ensure? -- nosy: +gvanrossum ___ Python tracker

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: Here are the possible courses of action to fix this. All require design changes, thus can be shot down on a whim. So I'll ask for advice and approval at python-dev first, to be sure that my efforts won't be scrapped. First, some

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-02 Thread Ivan Pozdeev
Change by Ivan Pozdeev : Added file: https://bugs.python.org/file47561/TkinterHanders3.py ___ Python tracker ___

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-29 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: > Look like the only way is to rearrange Tcl stack frames so that the right one > is on top. Scratch that. Tkinter allows to execute entire scripts where the order of the frames is important. --

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-28 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: Finally dug up the reason but unsure how to fix it. Here's the trace. The format is `$TID: $FUNCTION [some of the args]' 0x1A34: Tkapp_Call(_object *, _object *) 0x1A34: PythonCmd(void *, Tcl_Interp *, int, const char * *)

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-15 Thread Ivan Pozdeev
Change by Ivan Pozdeev : Removed file: https://bugs.python.org/file47535/TkinterHanders.py ___ Python tracker ___

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-15 Thread Ivan Pozdeev
Change by Ivan Pozdeev : Added file: https://bugs.python.org/file47536/TkinterHanders.py ___ Python tracker ___

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-14 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: Attached reproducing example for event handlers. If launching more than one EventThread, it abort()'s immediately. -- Added file: https://bugs.python.org/file47535/TkinterHanders.py ___ Python

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-14 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: Wait a second... I think I noticed another similar bug. In Tkapp_CallProc. Same case, Tkapp_CallArgs and Tkapp_CallDeallocArgs are called when not holding both locks. The attached example doesn't use Python event handlers, so it didn't

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-14 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: @terry.reedy Apparently, this bug has gone unnoticed for years (to be precise, since https://github.com/python/cpython/commit/b5bfb9f38c786c3330b2d52d93b664588c42283d in 2002), and there are all kinds of weird rumors circulating about

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-13 Thread Terry J. Reedy
Terry J. Reedy added the comment: I believe I have seen this exact error message within the last few months, and I found one example on SO. https://stackoverflow.com/questions/21209124/weird-error-that-comes-up-during-python-program-run -- nosy: +terry.reedy

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-13 Thread Ivan Pozdeev
Ivan Pozdeev added the comment: My best idea for a test as of now is to run the example ~20 times in a loop (or continuously for a comparable amount of time & threads) and catch and register any exceptions in all threads as per

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka versions: +Python 3.6, Python 3.7, Python 3.8 ___ Python tracker

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-10 Thread Ivan Pozdeev
Change by Ivan Pozdeev : -- keywords: +patch pull_requests: +6139 stage: -> patch review ___ Python tracker ___

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-10 Thread Ivan Pozdeev
Change by Ivan Pozdeev : Added file: https://bugs.python.org/file47530/TkinterCrash3-2-2.py ___ Python tracker ___

[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-04-10 Thread Ivan Pozdeev
New submission from Ivan Pozdeev : (Marked only 2.7 as affected but this would affect any branch if built with nonthreaded Tcl.) When running the attached TkinterCrash2-2.py repeatedly with 2.7.14 and 2.7 head, win7 x64, two kinds of errors pop up randomly: 1. Crashes