Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generating an image with exactly the same parameters twice causes an API error #55

Closed
ssube opened this issue Jan 15, 2023 · 1 comment · Fixed by #56
Closed

generating an image with exactly the same parameters twice causes an API error #55

ssube opened this issue Jan 15, 2023 · 1 comment · Fixed by #56
Labels
status/fixed issues that have been fixed and released type/bug broken features
Milestone

Comments

@ssube
Copy link
Owner

ssube commented Jan 15, 2023

reusing existing pipeline
expanding image for outpainting
[2023-01-15 11:33:31,112] ERROR in app: Exception on /api/inpaint [POST]
Traceback (most recent call last):
  File "C:\Users\ssube\stabdiff\onnx-try-2\onnx-web\api\onnx_env\lib\site-packages\flask\app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\ssube\stabdiff\onnx-try-2\onnx-web\api\onnx_env\lib\site-packages\flask\app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\ssube\stabdiff\onnx-try-2\onnx-web\api\onnx_env\lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "C:\Users\ssube\stabdiff\onnx-try-2\onnx-web\api\onnx_env\lib\site-packages\flask\app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\ssube\stabdiff\onnx-try-2\onnx-web\api\onnx_env\lib\site-packages\flask\app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "C:\Users\ssube\stabdiff\onnx-try-2\onnx-web\api\onnx_web\serve.py", line 566, in inpaint
    executor.submit_stored(
  File "C:\Users\ssube\stabdiff\onnx-try-2\onnx-web\api\onnx_env\lib\site-packages\flask_executor\executor.py", line 209, in submit_stored
    self.futures.add(future_key, future)
  File "C:\Users\ssube\stabdiff\onnx-try-2\onnx-web\api\onnx_env\lib\site-packages\flask_executor\futures.py", line 67, in add
    raise ValueError("future_key {} already exists".format(future_key))
ValueError: future_key inpaint_964648543_e399ee8cf9f642e19c1c589fb4b3d087c3d2af525f0e0720bbd48437c9103255.png already exists

The background jobs are not being removed after they are finished, from the looks of it, and a new job cannot be scheduled with the same key. However, the future for the job has already been created and the job does run - it just doesn't show up in the GUI.

The flask_executor docs are pretty clear the futures should be pop()'d once they are done: https://flask-executor.readthedocs.io/en/latest/api/flask_executor.html#flask_executor.futures.FutureCollection.pop

@ssube ssube added status/new issues that have not been confirmed yet type/bug broken features labels Jan 15, 2023
@ssube ssube added this to the v0.4 milestone Jan 15, 2023
@ssube
Copy link
Owner Author

ssube commented Jan 15, 2023

Cleaning up the futures in the /ready endpoint helps somewhat, in the happy path, but there needs to be some kind of timeout and sweep for finished jobs.

Worse, the output images are being overwritten when this happens - the future key and output filename are based on the same parameters and hash. Salting the filenames with a timestamp could help.

ssube added a commit that referenced this issue Jan 15, 2023
@ssube ssube added status/progress issues that are in progress and have a branch and removed status/new issues that have not been confirmed yet labels Jan 15, 2023
@ssube ssube closed this as completed Jan 15, 2023
@ssube ssube added status/fixed issues that have been fixed and released and removed status/progress issues that are in progress and have a branch labels Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/fixed issues that have been fixed and released type/bug broken features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant