Open SombreCode opened 1 year ago
running into this too any luck?
I have the same issue, and after many many trying, I found that : When the stable-diffusion-web start with --nowebui, the first request must completely finished then you can use multi thread to request。demo code:
`
@Test
public void badRequestSample() throws ExecutionException, InterruptedException {
CompletableFuture<?> future1 = CompletableFuture.runAsync(() ->text2ImgTest("black cat"));
CompletableFuture<?> future2 = CompletableFuture.runAsync(() ->text2ImgTest("white horse"));
CompletableFuture<?> future3 = CompletableFuture.runAsync(() ->text2ImgTest("high tree"));
CompletableFuture.allOf(future1, future2, future3).get();
}
@Test
public void goodRequestSample() throws ExecutionException, InterruptedException {
CompletableFuture<?> future1 = CompletableFuture.runAsync(() ->text2ImgTest("black cat"));
future1.get();
CompletableFuture<?> future2 = CompletableFuture.runAsync(() ->text2ImgTest("white horse"));
CompletableFuture<?> future3 = CompletableFuture.runAsync(() ->text2ImgTest("high tree"));
CompletableFuture.allOf(future2, future3).get();
}
`
I don't konw why but I guess the error happens in gradio:3.2.0 , I not sure as you can see, I am a java programmer
yea i found it was an extension blocking context, so when i uninstalled extension it worked, so i reached out to the affected extension with an issue
I have the same issue, and after many many trying, I found that : When the stable-diffusion-web start with --nowebui, the first request must completely finished then you can use multi thread to request。demo code:
`
@Test public void badRequestSample() throws ExecutionException, InterruptedException { CompletableFuture<?> future1 = CompletableFuture.runAsync(() ->text2ImgTest("black cat")); CompletableFuture<?> future2 = CompletableFuture.runAsync(() ->text2ImgTest("white horse")); CompletableFuture<?> future3 = CompletableFuture.runAsync(() ->text2ImgTest("high tree")); CompletableFuture.allOf(future1, future2, future3).get(); } @Test public void goodRequestSample() throws ExecutionException, InterruptedException { CompletableFuture<?> future1 = CompletableFuture.runAsync(() ->text2ImgTest("black cat")); future1.get(); CompletableFuture<?> future2 = CompletableFuture.runAsync(() ->text2ImgTest("white horse")); CompletableFuture<?> future3 = CompletableFuture.runAsync(() ->text2ImgTest("high tree")); CompletableFuture.allOf(future2, future3).get(); }
`
I don't konw why but I guess the error happens in gradio:3.2.0 , I not sure as you can see, I am a java programmer
this issue is indeed easily reproducible following this approach. default args of scripts are initialized in the first txt2img and img2img api calls. if you send multiple requests to the txt2img / img2img api endpoints at the same time, they break. fastapi uses an internal threadpool to execute non-async endpoints so apparently when two threads try to initialize default script args, bad things happen.
Running into the same issue. Did anyone find a solution for this?
yea i found it was an extension blocking context, so when i uninstalled extension it worked, so i reached out to the affected extension with an issue是的,我发现是一个扩展程序阻止了上下文,所以当我卸载了扩展程序后,问题就解决了,所以我联系了受影响的扩展程序以解决问题
@webcoderz Hello, can you tell me which extension caused this issue?
how to use the txt2img API?can u give a demo ?tks
@henbucuoshanghai https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/API
Is there an existing issue for this?
What happened?
when CALL txt2img api, return 500 Internal Server Error : {'error': 'AttributeError', 'detail': '', 'body': '', 'errors': 'click() and other events can only be called within a Blocks context.'}. restart program can temporarily resolve this problem.
Steps to reproduce the problem
possible occurrence when start program
What should have happened?
API return 200 and works fine
Commit where the problem happens
https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/89f9faa63388756314e8a1d96cf86bf5e0663045
What Python version are you running on ?
Python 3.10.x
What platforms do you use to access the UI ?
Linux
What device are you running WebUI on?
No response
What browsers do you use to access the UI ?
No response
Command Line Arguments
List of extensions
No
Console logs
Additional information
other error print