-
Notifications
You must be signed in to change notification settings - Fork 100
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 when signed in to Xbox since 1.19.40 #775
Comments
Maybe you need to implement the websocket java api in c++? It was recently added to the game, but I ignored it. |
Would stubbing the websocket functions resolve the high CPU usage? |
Probably not, websocket functions are already stubbed by automation.
Which libc function returns that error? |
It doesn't look like EAGAIN errors are coming through libc-shim, maybe they are being generated in the launcher's code, not the game's code |
Also, reverting the async xbox http client fixes the cpu usage, but makes skins and marketplace not load. gdb also shows the |
What WebSocket library should be used for something like this? I was able to fix the CPU usage issue by having it call onOpen when websocket connect is called, but nothing else. I stubbed the rest of the symbols for now. |
You could use libcurl, it has expermental websocket support. I started trying to implement it, meanwhile I have more important things to do. You could use the |
Where can I find a websocket example program using libcurl? I can't seem to find one. |
That's true it is hard to find examples at this time. |
Can you put what you have in a new branch? |
I don't have much, nothing I ever tested. It seems to be important to handle text and binary messages differently.
Seems like I altered ext/curl.cmake ExternalProject_Add(
curl_ext
URL "http://curl.haxx.se/download/curl-7.87.0.tar.gz"
INSTALL_DIR ${CMAKE_BINARY_DIR}/ext/curl
CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/ext/curl" "-DBUILD_CURL_EXE=OFF" "-DBUILD_SHARED_LIBS=OFF" "-DCURL_STATICLIB=ON" "-DCURL_DISABLE_LDAP=ON" "-DCMAKE_USE_LIBSSH2=OFF" "-DCMAKE_USE_OPENLDAP=OFF" "-DUSE_LIBIDN2=OFF" "-DENABLE_WEBSOCKETS=ON" "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}" "-DCMAKE_LINK_FLAGS=${CMAKE_LINK_FLAGS}" "-DCMAKE_LIBRARY_ARCHITECTURE=${CMAKE_LIBRARY_ARCHITECTURE}" ${CURL_EXT_EXTRA_OPTIONS}
) But CURL_EXT_EXTRA_OPTIONS should also work. I would use a writecb to call the message received java callbacks. Trust me that mostly nothing. |
I put a temporary fix for the CPU usage that can be used until websocket support is added at minecraft-linux/mcpelauncher-client#42 |
Regarding websocket, the source code for libhttpclient (what the game uses) is at https://github.com/microsoft/libHttpClient. Files for websocket can be found at https://github.com/microsoft/libHttpClient/blob/75dc4785c9f51af04b2dafad33579067f7fe4443/Build/libHttpClient.Android/src/main/java/com/xbox/httpclient/HttpClientWebSocket.java and https://github.com/microsoft/libHttpClient/tree/main/Source/WebSocket |
Describe the bug
When signed in to Xbox live, the game uses way more CPU than it should.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The CPU usage should not be super high when signed in.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
The thread consuming CPU usage is
REST Thread(0)
.strace
shows a lot ofEAGAIN (Resource temporarily unavailable)
errors on the thread. This is likely related to the Microsoft account disconnected message that also started in 1.19.40 that is shown when in the pause menu of a singleplayer world.The text was updated successfully, but these errors were encountered: