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

Client has been deleted but is still being used. This is most likely a bug in your application code #3231

Closed
Buruxianian opened this issue Jun 16, 2024 · 4 comments

Comments

@Buruxianian
Copy link

Description

Client has been deleted but is still being used. This is most likely a bug in your application code. See https://github.com/zauberzeug/nicegui/issues/3028 for more information.
Stack (most recent call last):
  File "main.py", line 7, in <module>
  File "nicegui/ui_run.py", line 177, in run
    Server.instance.run()
  File "nicegui/server.py", line 36, in run
    super().run(sockets=sockets)
  File "uvicorn/server.py", line 65, in run
  File "asyncio/runners.py", line 44, in run
  File "nicegui/awaitable_response.py", line 29, in _fire
    self.fire_and_forget()
  File "nicegui/client.py", line 214, in send_and_forget
    self.outbox.enqueue_message('run_javascript', {'code': code}, target_id)
  File "nicegui/outbox.py", line 51, in enqueue_message
    self.client.check_existence()
  File "nicegui/client.py", line 331, in check_existence
    log.warning('Client has been deleted but is still being used. This is most likely a bug in your application code. '

I am using version 1.4.27, but I cannot locate the issue from the prompt and did not use ui. log(). Can you provide a solution to this problem.

@python-and-fiction
Copy link

Any code of your problem?

@Buruxianian
Copy link
Author

Buruxianian commented Jun 16, 2024

@python-and-fiction
I cannot minimize the code, it is a data monitoring application. At the beginning, it was running steadily, but after a period of time, I tried to access the application again but did not respond. The above are all the error prompts. I saw this error in the running log, but I am not sure which code went wrong.
Furthermore, it is strange that after waiting for a certain amount of time, the application can be successfully accessed.

@Buruxianian Buruxianian reopened this Jun 16, 2024
@python-and-fiction
Copy link

@python-and-fiction I cannot minimize the code, it is a data monitoring application. At the beginning, it was running steadily, but after a period of time, I tried to access the application again but did not respond. The above are all the error prompts. I saw this error in the running log, but I am not sure which code went wrong. Furthermore, it is strange that after waiting for a certain amount of time, the application can be successfully accessed.

Is there any issue caused by the combination of multi-threaded or multi process code with ui.log?
Is there a combination of dead loop code and client connection?

@falkoschindler
Copy link
Contributor

Thanks for reporting this problem, @Buruxianian!
However, I have to assume that this is a bug in your user code rather than NiceGUI. In #3206 there is a very similar discussion about this warning, where I posted some explanation of what is going on and a recommendation on how to proceed. Let's close this issue as a duplicate and continue the discussion over there. Maybe we can improve the warning and its traceback to avoid such confusion.

@falkoschindler falkoschindler closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants