Skip to content

[bug]: After generation, two keyboard interrupts needed to shut down server #111

@lstein

Description

@lstein

Is there an existing issue for this problem?

  • I have searched the existing issues

Install method

Invoke's Launcher

Operating system

Linux

GPU vendor

Nvidia (CUDA)

GPU model

No response

GPU VRAM

No response

Version number

lstein/feature/elegant-shutdown branch

Browser

No response

System Information

No response

What happened

The branch lstein/feature/elegant-shutdown is supposed to make it possible to shut down the server by pressing the ^C (keyboard interrupt) key just once, rather than requiring two presses.

Currently, after any generation has occurred, pressing ^C gives this message followed by an indefinite hang:

^C[2026-03-02 08:56:20,522]::[ModelInstallService]::INFO --> Installer thread 132929897526976 exiting
[2026-03-02 08:56:20,536]::[InvokeAI]::INFO --> InvokeAI shutting down...

Pressing ^C again gives a short stack trace and the server finally does exit:

^CException ignored in: <module 'threading' from '/home/lstein/.local/share/uv/python/cpython-3.12.12-linux-x86_64-gnu/lib/python3.12/threading.py'>
Traceback (most recent call last):
  File "/home/lstein/.local/share/uv/python/cpython-3.12.12-linux-x86_64-gnu/lib/python3.12/threading.py", line 1624, in _shutdown
    lock.acquire()
KeyboardInterrupt: 

It is likely that there is a thread that is waiting on a lock. Please track this down and fix it.

What you expected to happen

One ^C should be sufficient to shut the server down cleanly.

How to reproduce the problem

No response

Additional context

No response

Discord username

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions