tclWinConsole: needEvent variable is used uninitialized
I believe this comes from a missing initialization in ConsoleCheckProc in tclWinConsole.c:838 but there must be something more about this because when I add this initialization:
int needEvent = 0;
then the console runs (run-time check error is gone) but the continuation lines are broken in the console: it is no longer possible to enter more characters. Example: just enter: "proc a {} {", hit the enter key and it's stuck.
87687f362fMerged fix for bug [baa51423c2] check-in2022-08-20 17:09:5490989a0ac8Added test for bug [baa51423c2] check-in2022-08-20 16:56:10
Ashok, may I assign to you since you touched this very recently? Thanks!
Fixed in [fce5cfe1c7e872fe]...
Just I must admit, I saw something that may be potentially dangerous:
ConsoleCheckProc locks two mutexes in a nested way. This is theoretically a candidate for a deadlock in certain circumstances.
Ashok, can we be sure there are no constellations where it could happen?
I mean TH-A locks gConsoleLock and want to lock handleInfoPtr->lock, in the same time TH-B that still hold the lock on handleInfoPtr->lock attempting to lock gConsoleLock for some reason, what would cause a freezing. We can have one actor more that (especially by read/write locks) make some exclusive (W) lock for some of them, so finally it could lead to hardly reproducible heisenbug.
Found the issue and fixed it. Testing now. @sebres - just initializing needEvent does not suffice. @sebres - regarding lock deadlocks, pretty much all my code (here, iocp, isapi) uses lock hierarchies to prevent deadlocks. See comments in the code (search for hierarchy) /Ashok
As an aside, I'm a little surprised the compiler did not warn of uninitialized use. I thought they would.
Comfirm [189e348c49] works for me. Thanks!