-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
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
High CPU usage on HTTPClient with threads (on slow server response) #33479
Comments
I think I understand the problem, and this is probably a defect introduced in #21976 . Lines 685 to 690 in 24e1039
A proper fix might be possible without breaking the upper API nor reintroducing the EOF read bug, but this needs further investigation. |
@AlexHolly can you try out #33785 and and let us know if it fixes your issue? |
It solves my case. Do you have an idea why downloading a file still needs so much CPU? |
Seems somewhat still valid in 3.2.3 |
I need to salvage #33785 to fix this. |
Godot version:
0ab0d11
OS/device including version:
Tested on Windows 10 and x11(Mint)
Issue description:
Maybe related to #32807
Using Theads to run HTTPClient Requests in the background is using 13-40% CPU (Reason is probably a while/requesting data from socket all the time instead of blocking until data is actually available)
I added a variable which reduces the CPU to ~ 0 - 5%
Currently it is always false.
godot/core/io/stream_peer_tcp.cpp
Line 310 in dcf0a60
Steps to reproduce:
Run example project
Check Taskmanager CPU usage or listen to your CPU fan :D
Minimal reproduction project:
http-bug.zip
Let me know if you think it is a bug I will open a PR with my solution.
This line should block until data comes in.
godot/core/io/http_client.cpp
Line 694 in 24e1039
Solution:
err = connection->get_partial_data(p_buffer + r_received, left, read, true);
The text was updated successfully, but these errors were encountered: