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

Android 14 not compatible with version 2.1.0 #766

Open
HimanshuImarticus opened this issue May 6, 2024 · 0 comments
Open

Android 14 not compatible with version 2.1.0 #766

HimanshuImarticus opened this issue May 6, 2024 · 0 comments
Labels

Comments

@HimanshuImarticus
Copy link

Socket connecting but showing ANRs in android 14 and working fine in lower android versions.

To Reproduce

Please fill the following code example:

Socket.IO server version: 4.0.0
Socket.IO java client version: 2.1.0

Client

public class SocketHelper {
    public static void main(String[] args) throws URISyntaxException {
            String protocol = ""https";
            String host = "apist.pegasust.imarticus.org";
            String port = mContext.getResources().getString(R.string.CHAT_HOST_PORT);
            String a_hid = SHA512Helper.sha512Generator(SharedPref.getAccountId(mContext));
            String token = TokenSecurityUtility.getAccessToken(mContext);
            token = (token == null) ? "" : token;
            options.multiplex = true;
            options.secure = false;
            options.transports = new String[]{WebSocket.NAME, Polling.NAME};
            SocketSSL.set(options);
            setUserTimeAtHandshake(System.currentTimeMillis());

            mSocket = IO.socket(String.format("%s://%s/?aid=%s&tokn=%s&ah=%s&utm=%s", protocol, host, account_id, token, a_hid, getUserTimeAtHandshake().toString()), options);
            mSocket.io().timeout(mContext.getResources().getInteger(R.integer.socket_timeout) * 1000);

            unbindSocket();
            bindSocket();
            mSocket.connect();
    }

private synchronized void unbindSocket() {
        if (mSocket == null) return;
        mSocket.off(SocketEvents.GROUP_MESSAGE, GroupMessageHandler.onGroupMessage);
}
private synchronized void bindSocket() {
        mSocket.on(SocketEvents.GROUP_MESSAGE, GroupMessageHandler.onGroupMessage);
}
}

Expected behavior
App should work fine in all android versions ,but ANR showing in android 14 versions but working fine in other lower android versions.

Logs for ANR :
Reason: Input dispatching timed out (f04a6f8 com.imarticus.debug/com.imarticus.activity.chat.GroupChatActivityNew (server) is not responding. Waited 10002ms for FocusEvent(hasFocus=true))
Parent: com.imarticus.debug/com.imarticus.activity.chat.GroupChatActivityNew
ErrorId: e4c5a88a-891d-4178-b235-38894dced697
Frozen: s[false] g[false]
Load: 15.15 / 13.46 / 13.28
------ Current CPU Core Info ------
- offline :
- online : 0-7
- AP Temp = 461
0 1 2 3 4 5 6 7
------------------------------------------------------------------------------------------------------------------
scaling_cur_freq 2002000 2002000 2002000 2002000 2002000 2002000 2002000 2002000
scaling_governor energy_step energy_step energy_step energy_step energy_step energy_step energy_step energy_step
scaling_max_freq 2002000 2002000 2002000 2002000 2002000 2002000 2002000 2002000
------------------------------------------------------------------------------------------------------------------
----- Output from /proc/pressure/memory -----
some avg10=0.52 avg60=0.43 avg300=0.22 total=7802033432
full avg10=0.34 avg60=0.24 avg300=0.11 total=4317159876
----- End output from /proc/pressure/memory -----
----- Output from /proc/pressure/cpu -----
some avg10=5.12 avg60=4.51 avg300=2.53 total=58027295578
----- End output from /proc/pressure/cpu -----
----- Output from /proc/pressure/io -----
some avg10=1.18 avg60=1.01 avg300=0.62 total=11476667565
full avg10=0.78 avg60=0.60 avg300=0.38 total=7101200695
----- End output from /proc/pressure/io -----

                                                                                                CPU usage from 1ms to 12132ms later (2024-05-06 19:02:37.705 to 2024-05-06 19:02:49.836):
                                                                                                  140% 19757/com.imarticus.debug: 131% user + 8.9% kernel / faults: 37204 minor 219 major
                                                                                                  94% 1366/system_server: 73% user + 21% kernel / faults: 46547 minor 1408 major
                                                                                                  26% 1931/com.android.systemui: 20% user + 6.2% kernel / faults: 11098 minor 348 major
                                                                                                  10% 4506/com.samsung.android.honeyboard: 8.4% user + 2.3% kernel / faults: 9772 minor 616 major
                                                                                                  9.8% 1075/surfaceflinger: 7% user + 2.8% kernel / faults: 682 minor 122 major
                                                                                                  7.5% 2767/adbd: 2.6% user + 4.9% kernel / faults: 9 minor
                                                                                                  6.4% 1909/com.android.phone: 5.2% user + 1.1% kernel / faults: 6286 minor 483 major
                                                                                                  5.6% 2334/com.google.android.ext.services: 4.2% user + 1.3% kernel / faults: 5817 minor 488 major
                                                                                                  5% 370/logd: 1.8% user + 3.2% kernel / faults: 617 minor 15 major
                                                                                                  4% 2467/com.sec.imsservice: 3% user + 0.9% kernel / faults: 2754 minor 489 major
                                                                                                47% TOTAL: 36% user + 10% kernel + 0.3% iowait + 0.7% softirq
                                                                                                CPU usage from 4517ms to 6411ms later (2024-05-06 19:02:42.221 to 2024-05-06 19:02:44.114):
                                                                                                  185% 1366/system_server: 99% user + 86% kernel / faults: 4445 minor 12 major
                                                                                                    96% 1374/Signal Catcher: 77% user + 18% kernel
                                                                                                    67% 21558/AnrAuxiliaryTas: 20% user + 47% kernel
                                                                                                    2.8% 6277/binder:1366_20: 2.8% user + 0% kernel
                                                                                                    1.4% 1394/android.ui: 1.4% user + 0% kernel
                                                                                                    1.4% 1397/android.anim: 1.4% user + 0% kernel
                                                                                                    1.4% 1410/batterystats-ha: 1.4% user + 0% kernel
                                                                                                    1.4% 1517/InputDispatcher: 1.4% user + 0% kernel
                                                                                                    1.4% 1518/InputReader: 0% user + 1.4% kernel
                                                                                                    1.4% 6028/binder:1366_1F: 1.4% user + 0% kernel
                                                                                                  167% 19757/com.imarticus.debug: 153% user + 13% kernel / faults: 273 minor 4 major
                                                                                                    92% 19757/imarticus.debug: 86% user + 5.5% kernel
                                                                                                    19% 21150/OkHttp Dispatch: 16% user + 2.7% kernel
                                                                                                    16% 19836/RenderThread: 11% user + 5.5% kernel
                                                                                                    5.5% 19959/arch_disk_io_0: 5.5% user + 0% kernel
                                                                                                    2.7% 19884/binder:19757_4: 2.7% user + 0% kernel
                                                                                                    2.7% 19963/arch_disk_io_1: 2.7% user + 0% kernel
                                                                                                    2.7% 19964/arch_disk_io_2: 2.7% user + 0% kernel
                                                                                                    2.7% 19966/arch_disk_io_3: 2.7% user + 0% kernel
                                                                                                    2.7% 20006/binder:19757_5: 2.7% user + 0% kernel

Platform:

  • Device: [e.g. Samsung F13]
  • OS: [e.g. Android 14]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant