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

[Bug]: /v1/progress crashes with NaN. Please Fix. #13225

Open
1 task done
gravitate-dev opened this issue Sep 13, 2023 · 2 comments
Open
1 task done

[Bug]: /v1/progress crashes with NaN. Please Fix. #13225

gravitate-dev opened this issue Sep 13, 2023 · 2 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@gravitate-dev
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

*** API error: GET: http://127.0.0.1:7860/sdapi/v1/progress {'error': 'TypeError', 'detail': '', 'body': '', 'errors': "unsupported operand type(s) for -: 'float' and 'NoneType'"}
Traceback (most recent call last):
File "C:\stable-diffusion\venv\Lib\site-packages\anyio\streams\memory.py", line 98, in receive
return self.receive_nowait()
^^^^^^^^^^^^^^^^^^^^^
File "C:\stable-diffusion\venv\Lib\site-packages\anyio\streams\memory.py", line 93, in receive_nowait
raise WouldBlock
anyio.WouldBlock

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\base.py", line 78, in call_next
    message = await recv_stream.receive()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\stable-diffusion\venv\Lib\site-packages\anyio\streams\memory.py", line 118, in receive
    raise EndOfStream
anyio.EndOfStream

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\stable-diffusion\modules\api\api.py", line 187, in exception_handling
    return await call_next(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\base.py", line 84, in call_next
    raise app_exc
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\base.py", line 70, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\base.py", line 108, in __call__
    response = await self.dispatch_func(request, call_next)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\stable-diffusion\modules\api\api.py", line 151, in log_and_time
    res: Response = await call_next(req)
                    ^^^^^^^^^^^^^^^^^^^^
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\base.py", line 84, in call_next
    raise app_exc
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\base.py", line 70, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\cors.py", line 84, in __call__
    await self.app(scope, receive, send)
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\gzip.py", line 24, in __call__
    await responder(scope, receive, send)
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\gzip.py", line 44, in __call__
    await self.app(scope, receive, self.send_with_gzip)
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "C:\stable-diffusion\venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "C:\stable-diffusion\venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\routing.py", line 66, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "C:\stable-diffusion\venv\Lib\site-packages\fastapi\routing.py", line 237, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\stable-diffusion\venv\Lib\site-packages\fastapi\routing.py", line 165, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\stable-diffusion\venv\Lib\site-packages\starlette\concurrency.py", line 41, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\stable-diffusion\venv\Lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\stable-diffusion\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "C:\stable-diffusion\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\stable-diffusion\modules\api\api.py", line 505, in progressapi
    time_since_start = time.time() - shared.state.time_start
                       ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

Steps to reproduce the problem

  1. Call /progress

What should have happened?

Shouldnt crash. Crashes the whole a1111

Sysinfo

latest.

What browsers do you use to access the UI ?

No response

Console logs

*** API error: GET: http://127.0.0.1:7860/sdapi/v1/progress {'error': 'TypeError', 'detail': '', 'body': '', 'errors': "unsupported operand type(s) for -: 'float' and 'NoneType'"}
    Traceback (most recent call last):
      File "C:\stable-diffusion\venv\Lib\site-packages\anyio\streams\memory.py", line 98, in receive
        return self.receive_nowait()
               ^^^^^^^^^^^^^^^^^^^^^
      File "C:\stable-diffusion\venv\Lib\site-packages\anyio\streams\memory.py", line 93, in receive_nowait
        raise WouldBlock
    anyio.WouldBlock

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\base.py", line 78, in call_next
        message = await recv_stream.receive()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\stable-diffusion\venv\Lib\site-packages\anyio\streams\memory.py", line 118, in receive
        raise EndOfStream
    anyio.EndOfStream

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\stable-diffusion\modules\api\api.py", line 187, in exception_handling
        return await call_next(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\base.py", line 84, in call_next
        raise app_exc
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\base.py", line 70, in coro
        await self.app(scope, receive_or_disconnect, send_no_error)
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\base.py", line 108, in __call__
        response = await self.dispatch_func(request, call_next)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\stable-diffusion\modules\api\api.py", line 151, in log_and_time
        res: Response = await call_next(req)
                        ^^^^^^^^^^^^^^^^^^^^
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\base.py", line 84, in call_next
        raise app_exc
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\base.py", line 70, in coro
        await self.app(scope, receive_or_disconnect, send_no_error)
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\cors.py", line 84, in __call__
        await self.app(scope, receive, send)
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\gzip.py", line 24, in __call__
        await responder(scope, receive, send)
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\gzip.py", line 44, in __call__
        await self.app(scope, receive, self.send_with_gzip)
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
        raise exc
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
        await self.app(scope, receive, sender)
      File "C:\stable-diffusion\venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
        raise e
      File "C:\stable-diffusion\venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
        await self.app(scope, receive, send)
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\routing.py", line 718, in __call__
        await route.handle(scope, receive, send)
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\routing.py", line 276, in handle
        await self.app(scope, receive, send)
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\routing.py", line 66, in app
        response = await func(request)
                   ^^^^^^^^^^^^^^^^^^^
      File "C:\stable-diffusion\venv\Lib\site-packages\fastapi\routing.py", line 237, in app
        raw_response = await run_endpoint_function(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\stable-diffusion\venv\Lib\site-packages\fastapi\routing.py", line 165, in run_endpoint_function
        return await run_in_threadpool(dependant.call, **values)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\stable-diffusion\venv\Lib\site-packages\starlette\concurrency.py", line 41, in run_in_threadpool
        return await anyio.to_thread.run_sync(func, *args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\stable-diffusion\venv\Lib\site-packages\anyio\to_thread.py", line 33, in run_sync
        return await get_asynclib().run_sync_in_worker_thread(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\stable-diffusion\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
        return await future
               ^^^^^^^^^^^^
      File "C:\stable-diffusion\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
        result = context.run(func, *args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\stable-diffusion\modules\api\api.py", line 505, in progressapi
        time_since_start = time.time() - shared.state.time_start
                           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
    TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

Additional information

No response

@gravitate-dev gravitate-dev added the bug-report Report of a bug, yet to be confirmed label Sep 13, 2023
@gravitate-dev
Copy link
Author

Its not nice to crash a1111. Perhaps setting 0 here would be better than crashing a1111
time_start = shared.state.time_start if shared.state.time_start is not None else 0
time_since_start = time.time() - time_start

@w-e-w
Copy link
Collaborator

w-e-w commented Sep 13, 2023

yes I found under an extreme condition extreme situation that it is possible for shared.state.time_start to be None
which triggers an exception that you're describing
but I don't see it crash the entire server
also by the fact that you are receiving that reply message ment the server has not crashed
perhaps you're using the word crash incorrectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

2 participants