3
$\begingroup$

Has anyone run into an issue with Blender randomly freezing/hanging when you attempt to close while the console window is open? I can't say for sure that the console is the murder weapon, but after a lot of testing, it seems likely. I've tried disabling all non-official add-ons (including my own) with no change. I'm running into this on two Windows PCs with very different hardware.

Nothing prints out in the console when I press the Windows "x" button. It just instantly freezes and doesn't respond until I force it closed with task manager. It randomly hangs maybe once every 4-5 times I close it. Sometimes much more frequently.

I'm curious to know if this is happening to others, but mainly I'm looking for any type of solution. Maybe a way to force the console window closed before exit? I don't think it can be done with atexit, because it never seems to get executed in my add-on before Blender locks up. If nothing else, it may be possible to create a custom hotkey that closes the console window, then requests Blender to close?

$\endgroup$
6
  • 2
    $\begingroup$ Possibly you have some text in the console window accidentally selected. This will cause any additional output to the console to ‘hang’ which will block Blender exitting. Next time it hangs, switch the the console window and press Return to accept and clear any selected text and see if it then closes. $\endgroup$ Sep 23, 2019 at 13:25
  • $\begingroup$ I think you are right. It freezes when you have any text highlighted in the console. And it responds immediately if you press escape (to deselect text). Is this a bug, or just something I don't fully understand? Is there any way to avoid it other than not highlighting text? I apparently do that a lot to keep track of where I'm looking. $\endgroup$
    – Robert
    Sep 24, 2019 at 17:54
  • 2
    $\begingroup$ I don't think it's a bug, just how the Windows console works. When you have text highlighting it's in 'Mark' mode to mark the part you want to copy to the clipboard. To prevent it changing while marking, any output is 'held' to prevent changes. If Blender tries to output some text during that time it's 'blocked' and has to wait until the console is released from 'mark' mode before it can move on - so it appears to just hang. $\endgroup$ Sep 24, 2019 at 20:09
  • $\begingroup$ Ah, that makes a lot of sense. So it would probably help to automatically close the console immediately on exit, if such a thing were possible. Doesn't look like it is, though. Even if I managed to catch an exit event and close it, some other add-on may get notified before mine and try to print. One possible solution during add-on development would be a hot-key that does both. Thanks for your wisdom! $\endgroup$
    – Robert
    Sep 24, 2019 at 22:57
  • $\begingroup$ Yeah - I don't know if that is possible. During add-on development I usually get in the habit of closing the console window rather than blender window when I want to restart Blender. This forces closure of Blender regardless of what you were doing (even without prompting for save/discard) and avoids any problems of it being hung in the console. $\endgroup$ Sep 27, 2019 at 22:40

2 Answers 2

3
$\begingroup$

Clicking in the console window and accidentally selecting some text will put the console window into 'selection' or 'mark' mode to mark the part you want to copy to the clipboard. This will cause any additional output to the console to ‘hang’ (it blocks any further output to the console so the visible text doesn't change while you're trying to mark your selection) which will block Blender when it tries to output additional text to the console such as just before it exits. Pressing Return or Esc while on the console window will accept or cancel selection mode, allowing Blender to continue outputting to the console so it can continue.

This is how the Windows console works (rather than being a Blender feature) and the only way of avoiding it is to be careful when switching to the console window and avoid selecting any text (or immediately cancel 'mark' mode by pressing Return or Esc).

$\endgroup$
3
  • 1
    $\begingroup$ The feature is called QuickEdit Mode. $\endgroup$
    – Robert Gützkow
    Sep 30, 2019 at 20:47
  • 1
    $\begingroup$ Another thing to note is that it doesn't matter if you close the console window before exiting Blender. If any text was highlighted when the console was closed, Blender will still hang. It's like the states are still active, just not visible. That can be confirmed by re-opening the console and seeing the same text highlighted. $\endgroup$
    – Robert
    Sep 30, 2019 at 21:14
  • $\begingroup$ @Robert That’s interesting. I suppose the Show/Hide console options do just that; it’s still there, just hidden. $\endgroup$ Sep 30, 2019 at 21:41
0
$\begingroup$

Not touch the console window, still hangs, neither enter or esc will work since nothing selected, only way to close is Alt-F4

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .