invoke-ai / InvokeAI

Invoke is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, and serves as the foundation for multiple commercial products.
https://invoke-ai.github.io/InvokeAI/
Apache License 2.0
23.34k stars 2.4k forks source link

[bug]: Deleting multiple images quickly leads to error message #2474

Closed Barafu closed 1 year ago

Barafu commented 1 year ago

Is there an existing issue for this?

OS

Windows

GPU

cuda

VRAM

No response

What happened?

Current git main. Quickly deleting multiple images sometimes produces an error message, and red Error status in UI. My uneducated guess is that the server tries to delete the file while it is still being read for displaying in UI.

Screenshots

* --web was specified, starting web server...
* Initializing, be patient...
>> Initialization file C:\Users\Barafu\invokeai\invokeai.init found. Loading...
>> Started Invoke AI Web Server!
>> Default host address now 127.0.0.1 (localhost). Use --host 0.0.0.0 to bind any address.
>> Point your browser at http://127.0.0.1:9090
>> System config requested
>> Patchmatch initialized
>> Delete requested "outputs/000022.7d241f63.2138150993.png"
>> Delete requested "outputs/000021.7ce893c7.4222146570.png"
>> Delete requested "outputs/000020.fb599385.1895560125.png"
>> Delete requested "outputs/000019.3ddae83e.191634943.png"
>> Delete requested "outputs/000018.26772ada.285674991.png"
>> Delete requested "outputs/000017.874392e3.4046137040.png"
>> Delete requested "outputs/000016.57d157c5.913777982.png"
>> Delete requested "outputs/000015.7eea7b1f.3916088123.png"
>> Delete requested "outputs/000014.c9795944.3263043259.png"
>> Delete requested "outputs/000013.5b91952a.160526180.png"
>> Delete requested "outputs/000012.cf86ed2b.2370171665.png"
>> Delete requested "outputs/000011.ce26f47d.1617711614.png"
>> Delete requested "outputs/000010.b0f454c5.484733421.png"

Traceback (most recent call last):
  File "C:\Software\InvokeAI\backend\invoke_ai_web_server.py", line 785, in handle_delete_image
    send2trash(path)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\send2trash\plat_win_legacy.py", line 147, in send2trash
    raise WindowsError(result, FormatError(result), paths)
BrokenPipeError: [Errno 32] The process cannot access the file because it is being used by another process.: ['C:\\Users\\Barafu\\invokeai\\outputs\\000010~1.PNG']

Traceback (most recent call last):
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\hubs\selects.py", line 59, in wait
    listeners.get(fileno, hub.noop).cb(fileno)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\greenthread.py", line 221, in main
    result = function(*args, **kwargs)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\wsgi.py", line 837, in process_request
    proto.__init__(conn_state, self)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\wsgi.py", line 352, in __init__
    self.finish()
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\wsgi.py", line 751, in finish
    BaseHTTPServer.BaseHTTPRequestHandler.finish(self)
  File "C:\Users\Barafu\anaconda3\envs\Pyth310\lib\socketserver.py", line 811, in finish
    self.wfile.close()
  File "C:\Users\Barafu\anaconda3\envs\Pyth310\lib\socket.py", line 723, in write
    return self._sock.send(b)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\greenio\base.py", line 401, in send
    return self._send_loop(self.fd.send, data, flags)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\greenio\base.py", line 388, in _send_loop
    return send_method(data, *args)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
Removing descriptor: 4340
Traceback (most recent call last):
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\hubs\selects.py", line 59, in wait
    listeners.get(fileno, hub.noop).cb(fileno)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\greenthread.py", line 221, in main
    result = function(*args, **kwargs)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\wsgi.py", line 837, in process_request
    proto.__init__(conn_state, self)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\wsgi.py", line 352, in __init__
    self.finish()
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\wsgi.py", line 751, in finish
    BaseHTTPServer.BaseHTTPRequestHandler.finish(self)
  File "C:\Users\Barafu\anaconda3\envs\Pyth310\lib\socketserver.py", line 811, in finish
    self.wfile.close()
  File "C:\Users\Barafu\anaconda3\envs\Pyth310\lib\socket.py", line 723, in write
    return self._sock.send(b)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\greenio\base.py", line 401, in send
    return self._send_loop(self.fd.send, data, flags)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\greenio\base.py", line 388, in _send_loop
    return send_method(data, *args)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
Removing descriptor: 3812
Traceback (most recent call last):
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\hubs\hub.py", line 476, in fire_timers
    timer()
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\hubs\timer.py", line 59, in __call__
    cb(*args, **kw)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\greenthread.py", line 221, in main
    result = function(*args, **kwargs)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\wsgi.py", line 837, in process_request
    proto.__init__(conn_state, self)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\wsgi.py", line 352, in __init__
    self.finish()
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\wsgi.py", line 751, in finish
    BaseHTTPServer.BaseHTTPRequestHandler.finish(self)
  File "C:\Users\Barafu\anaconda3\envs\Pyth310\lib\socketserver.py", line 811, in finish
    self.wfile.close()
  File "C:\Users\Barafu\anaconda3\envs\Pyth310\lib\socket.py", line 723, in write
    return self._sock.send(b)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\greenio\base.py", line 401, in send
    return self._send_loop(self.fd.send, data, flags)
  File "C:\Software\InvokeAI\invokeai\lib\site-packages\eventlet\greenio\base.py", line 388, in _send_loop
    return send_method(data, *args)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
>> Delete requested "outputs/000009.ce8f1833.1500603989.png"
>> Delete requested "outputs/000008.7506ba65.1298814730.png"
>> Delete requested "outputs/000007.dc95b861.148565734.png"
>> Delete requested "outputs/000006.6e159f4d.3043566015.png"
>> Delete requested "outputs/000005.4d776694.4192925834.png"
>> Delete requested "outputs/000004.0f29bb42.1124991378.png"

Additional context

No response

Contact Details

No response

lstein commented 1 year ago

@psychedelicious , @blessedcoolant Could you look into this?

psychedelicious commented 1 year ago

@Barafu

Something like what you suggested must be happening. This could be addressed by better error handling in the server.

However, we are not making any changes to the web server as we have just begun a migration to a better server. I don't think we will fix this unless the same issue occurs on the new server, in which case we definitely will fix it.

Thanks for reporting the bug though!

Barafu commented 1 year ago

Keep this open, I will re-test when the refactoring is done.

github-actions[bot] commented 1 year ago

There has been no activity in this issue for 14 days. If this issue is still being experienced, please reply with an updated confirmation that the issue is still being experienced with the latest release.

Barafu commented 1 year ago

I could not reproduce it in several tries.

Bacon-Tech commented 1 year ago

I also have this problem when running bulk images. But for me its a problem that is intermittent.

image

image

Barafu commented 1 year ago

I just got it again. Quickly deleting multiple files by tapping the red delete button with mouse. It continued to work after that. Files disappeared from the interface, but were not deleted from the output folder, and returned to the interface after pressing F5. Then I deleted them all using the same delete button. Files were removed and disappeared from "output" folder, however theirt counterparts in "output-thumbnails" stayed again. I did not even open the Canvas tab since full reinstallation.

This time it is version 2.3.5 from the installer, (NOT the git version, I removed it).

>> Delete requested "outputs/000171.aa54fb09.4069021259.postprocessed.png"

Traceback (most recent call last):
  File "C:\Users\Barafu\invokeai\.venv\lib\site-packages\invokeai\backend\invoke_ai_web_server.py", line 909, in handle_delete_image
    send2trash(path)
  File "C:\Users\Barafu\invokeai\.venv\lib\site-packages\send2trash\win\legacy.py", line 150, in send2trash
    paths = [get_short_path_name(path) for path in paths]
  File "C:\Users\Barafu\invokeai\.venv\lib\site-packages\send2trash\win\legacy.py", line 150, in <listcomp>
    paths = [get_short_path_name(path) for path in paths]
  File "C:\Users\Barafu\invokeai\.venv\lib\site-packages\send2trash\win\legacy.py", line 135, in get_short_path_name
    raise WindowsError(err_no, FormatError(err_no), long_path)
FileNotFoundError: [Errno 2] The system cannot find the file specified.: '\\\\?\\C:\\Users\\Barafu\\invokeai\\output\\000171.aa54fb09.4069021259.postprocessed.png'
psychedelicious commented 1 year ago

This is fixed in main (which is what 3.0 will be based on) - we aren't going to fix this on 2.3 as it's on its way out. Sorry!