Did some experiments... On 11/21/2010 06:47 PM, Joost 't Hart wrote: > Hi, > > [Linux/CVS/stockfish 1.6.2] > > I am looking at an irritating problem in the annotation realm that I > cannot resolve. > > It is tricky to reproduce and may point to some tcl threading and/or > performance problem: > > 1) Put a position (with some moves to follow) on the board that allows > the engine to spot a mate. > > 2) Start the engine. Stockfish produces a diarrhea of exactly 100 > identical mating lines within, say, 20 seconds. Scid needs a lot of > energy to consume this and transport the lines into the analysis window. > After the 100 lines have come in, things return into idle state, as the > engine stops his output. > > 3) Now do not wait for these 100 lines to complete. As soon as the first > lines come in, open the annotation dialogue, enter your favourite > annotation options and start the annotation. Try to complete all this > before the diarrhea stops. > > 4) The dialogue closes, the engine is restarted and does his initial > thinking. Now wait until autoplay produces the first main line move on > the board. This time depends on the thinking time you set in the dialogue. > > A run-time error from tcl pops up, complaining that "grab $w" cannot > succeed because "$w" does no longer exist (in analysis.tcl, line 858). > Well, this is true, as it refers to the annotation dialogue window, > which was closed some time ago. > > The grab command (what is it good for?) is at the end of the code > actually creating the annotation dialogue that we used to configure and > start annotation!
The grab command instructs the entire application UI not to accept any user action outside the configAnnotation window. This could be a useful thing, yet for this window I cannot see why this would be required. The window has not taken any relevant application state space inside, so I cannot see why e.g. opening another base while the config window is open could be harmful. What do I miss? > Apparently scid was so busy grabbing engine lines, that it could not > make it to this instruction before the dialogue was closed because of > our "OK, start annotation" command? Is it the "update" command just > before that is blocked because of the business elsewhere? What does this > command do? Yes, it is the update command that is blocking the dialogue creation thread for as long as the engine lines pop in. It looks as if the engine is keeping some tcl background thread permanently running - or at least ready-to-run-but-maybe-not-the-ready-job-whith-highest-priority. With us clicking OK while the lines still come in, blocking is canceled because the OK-handler destroys the window. And because of this only, as it is supposed to block until all background threads have blocked as well. Unfortunately, the grab that sits behind the block cannot succeed anymore... Tcl's update comes in another flavour as well. If I put "update idletasks" instead, the application is more robust, but the side effect is that the response to OK is also delayed until the engine lines stop coming in. More robust it is, but it feels not right to the user either. From this story, I see two solutions: 1) Stop the engine as soon as we start annotation (config). This is - admittedly - a bit silly, but if the user really wants to start annotation, the engine will (temporarily) be stopped anyway as soon as he hits OK. 2) Do not set the grab status. If we leave this window modality out, the update command is also not required. I did not see a problem with this, but - as stated above - I may have missed something. > If, in step 3 above, we DO wait until all lines have come in before > hitting the OK button (the dialogue itself can be opened any time) the > problem does not show. > > Any advice is appreciated. > Can someone confirm that this problem does reproduce on 4.2.2 as well? I > do not have that at hand. Anyone still hanging in there? > Cheers, > Joost. > > PS: The error pop-up can safely be acknowledged. Annotation continues as > expected. > > ------------------------------------------------------------------------------ > Beautiful is writing same markup. Internet Explorer 9 supports > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3. > Spend less time writing and rewriting code and more time creating great > experiences on the web. Be a part of the beta today > http://p.sf.net/sfu/msIE9-sfdev2dev > _______________________________________________ > Scid-users mailing list > Scid-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/scid-users > ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ Scid-users mailing list Scid-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/scid-users