sdwebui-w-horde / sd-webui-stable-horde-worker

Stable Horde Unofficial Worker Bridge as Stable Diffusion WebUI (AUTOMATIC1111) Extension
GNU Affero General Public License v3.0
60 stars 19 forks source link

[Bug]: in on_app_started, run_until_complete(horde.run()) blocks, prevents other startup callbacks #109

Closed ivucica closed 1 year ago

ivucica commented 1 year ago

Is there existing issue for this?

Does this happen on the latest commit?

What happened?

Firing up AUTOMATIC1111 webui with this extension installed breaks other modules that depend on on_app_started callbacks by preventing them from running at all.

Civitai’s helper and others fail to register their APIs completely, for example.

I’m not familiar enough with Python’s async to triage what the bug is: it looks like the invocation of loop.run_until_complete does indeed expect a coroutine object which is returned as a result of invoking an async def method (so () on a function with an infinite loop itself is not a bug, it seems), so it must be that horde.run() with its infinite loop is waited on until the never-going-to-happen completion.

This bug is particularly insidious, because it doesn’t reveal the extent of breakage in the webUI, because the UI starts to work even before startup is done. It’s just that other extensions look half broken.

Steps to reproduce

  1. Install the worker extension.
  2. Observe how the “Startup time: 11.6s (import torch:…” line never appears, indicating app_started_callback loop never completed.

What did you expect to happen?

The mere presence of the extension does not prevent initialization of other extensions.

Stable Diffusion WebUI Commit SHA

baf6946e06 (tag v1.3.2)

What operating system are you seeing the problem on?

Debian / Ubuntu

What browsers are you seeing the problem on?

Chrome

Additional information

No response

MaikoTan commented 1 year ago

This should be fixed by https://github.com/sdwebui-w-horde/sd-webui-stable-horde-worker/commit/9edcf3bb7048115292107aba3e1e4ae18e1a25b7 , please check and feedback.

ivucica commented 1 year ago

I believe this is now resolved. I'll file a new bug about settings seemingly not saving correctly.