easemob / im_flutter_sdk

环信im flutter sdk, example中包含ui代码.
MIT License
234 stars 86 forks source link

调用登录相关SDK耗时太长 #508

Closed ixre closed 2 years ago

ixre commented 2 years ago

登录步骤: kickAllDevices -> login -> load groups and contacts -> jump to home page

这个过程在某些用户网络情况下,  有用户反馈耗时过长(最长30多秒), 加载群和联系人已经在APP做了本地缓存+服务器数据合并, 但登录和第一次加载数据无法避免.

本地用梯子代理模拟出了这种情况, 以下为截取的日志, 其中登录约为5秒, 不代理1秒

I/flutter ( 1824): 2022-05-17 15:12:20.275532 [ bz][ info]: 开始登录2022-05-17 15:12:20.275485
I/flutter ( 1824): 2022-05-17 15:12:20.278800 [ bz][ info]: 开始登录
I/flutter ( 1824): 2022-05-17 15:12:20.304401 [ bz][ info]: [ dio][ request]: #0/ https://xxxx.com/prefetch/get
E/Surface ( 1824): getSlotFromBufferLocked: unknown buffer: 0xc296a3a0
I/flutter ( 1824): 2022-05-17 15:12:20.399355 [ bz][ info]: [ dio][ request]: #1/ https://xxxx.com/login
I/flutter ( 1824): 2022-05-17 15:12:20.719602 [ bz][ info]: [ Dio][ Info]:url :/prefetch/get; {"errCode":0,"errMsg":"","data":"ok"}
I/flutter ( 1824): 2022-05-17 15:12:20.763454 [ bz][ info]: [ Dio][ Info]:url :/login; {"access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiIxNiIsImV4cCI6MTY1MjkwMTE0MiwiaXNzIjoiZ28ybyIsInN1YiI6ImdvMm8tc2VydmVyLWp3dCJ9.ahllSE1QQBF9WGhQcxYUXajNSs3lsr8Lef-h-RlIl_w","code":0}
I/flutter ( 1824): 2022-05-17 15:12:20.767420 [ bz][ info]: 登录接口请求完成,开始登录环信
I/flutter ( 1824): EaseMob | V | kickAllDevices: baozhang367, "******"
D/ONE SDK ( 1824): [2022/05/17 15:12:20:771]: current host: domain: a1-v2.easemob.com port: 443
D/ONE SDK ( 1824): [2022/05/17 15:12:20:771]: httprequest perform: https://a1-v2.easemob.com:443/xxxxxxxxxx/disconnect
I/flutter ( 1824): [ App][ Info]: 已存储令牌2022-05-17 15:12:20.778445
D/ONE SDK ( 1824): [2022/05/17 15:12:22:222]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:22:222]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:124975131459585
D/ONE SDK ( 1824): [2022/05/17 15:12:22:250]: log: level: 1, area: 1, Parser::isEnough() current length: 482 expect lenght: 487
D/ONE SDK ( 1824): [2022/05/17 15:12:22:250]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:22:250]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:125013935063041
D/ONE SDK ( 1824): [2022/05/17 15:12:22:277]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:22:277]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:124975131459585
D/ONE SDK ( 1824): [2022/05/17 15:12:22:285]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:22:285]: _EMAChatManagerListenerImpl onReceiveMessage
D/ONE SDK ( 1824): [2022/05/17 15:12:22:290]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:22:290]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:125013935063041
D/EMChatManager( 1824): convID:124975131459585
D/ONE SDK ( 1824): [2022/05/17 15:12:22:312]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:22:312]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:124975131459585
D/ONE SDK ( 1824): [2022/05/17 15:12:22:352]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:22:352]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:125008735174657
D/ONE SDK ( 1824): [2022/05/17 15:12:22:394]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:22:394]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:125008735174657
D/ONE SDK ( 1824): [2022/05/17 15:12:22:424]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:22:424]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:125008735174657
D/ONE SDK ( 1824): [2022/05/17 15:12:22:457]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:22:457]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:125008735174657
D/ONE SDK ( 1824): [2022/05/17 15:12:22:493]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:22:493]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:125008735174657
D/ONE SDK ( 1824): [2022/05/17 15:12:23:190]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:23:190]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:125013935063041
I/flutter ( 1824): 2022-05-17 15:12:23.277675 [ bz][ info]: 开始检查2022-05-17 15:12:23.277471
I/flutter ( 1824): 2022-05-17 15:12:24.273669 [ bz][ info]: 开始检查2022-05-17 15:12:24.273326
I/flutter ( 1824): 2022-05-17 15:12:25.273757 [ bz][ info]: 开始检查2022-05-17 15:12:25.273642
I/flutter ( 1824): 2022-05-17 15:12:26.274146 [ bz][ info]: 开始检查2022-05-17 15:12:26.274043
I/flutter ( 1824): 2022-05-17 15:12:27.274199 [ bz][ info]: 开始检查2022-05-17 15:12:27.274093
I/flutter ( 1824): 2022-05-17 15:12:28.273442 [ bz][ info]: 开始检查2022-05-17 15:12:28.273399
I/flutter ( 1824): 2022-05-17 15:12:29.274145 [ bz][ info]: 开始检查2022-05-17 15:12:29.274040
D/ONE SDK ( 1824): [2022/05/17 15:12:30:159]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:30:160]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:125013935063041
D/ONE SDK ( 1824): [2022/05/17 15:12:30:223]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:30:223]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:125008735174657
I/flutter ( 1824): 2022-05-17 15:12:30.273444 [ bz][ info]: 开始检查2022-05-17 15:12:30.273402
D/ONE SDK ( 1824): [2022/05/17 15:12:31:185]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:31:185]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:125008735174657
I/flutter ( 1824): 2022-05-17 15:12:31.274258 [ bz][ info]: 开始检查2022-05-17 15:12:31.274210
I/flutter ( 1824): 2022-05-17 15:12:32.273136 [ bz][ info]: 开始检查2022-05-17 15:12:32.273096
I/flutter ( 1824): 2022-05-17 15:12:33.274470 [ bz][ info]: 开始检查2022-05-17 15:12:33.274140
I/flutter ( 1824): 2022-05-17 15:12:34.273903 [ bz][ info]: 开始检查2022-05-17 15:12:34.273864
I/flutter ( 1824): 2022-05-17 15:12:35.274001 [ bz][ info]: 开始检查2022-05-17 15:12:35.273754
I/flutter ( 1824): 2022-05-17 15:12:36.274215 [ bz][ info]: 开始检查2022-05-17 15:12:36.274077
I/flutter ( 1824): 2022-05-17 15:12:37.274348 [ bz][ info]: 开始检查2022-05-17 15:12:37.274244
D/ONE SDK ( 1824): [2022/05/17 15:12:38:256]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:38:256]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:125013935063041
D/ONE SDK ( 1824): [2022/05/17 15:12:38:281]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:38:281]: _EMAChatManagerListenerImpl onReceiveMessage
I/flutter ( 1824): 2022-05-17 15:12:38.295469 [ bz][ info]: 开始检查2022-05-17 15:12:38.294672
D/ONE SDK ( 1824): [2022/05/17 15:12:38:301]: callbackReceievedMessages : shouldCreate : 1
D/EMChatManager( 1824): convID:124975131459585
D/ONE SDK ( 1824): [2022/05/17 15:12:38:316]: _EMAChatManagerListenerImpl onReceiveMessage
D/ONE SDK ( 1824): [2022/05/17 15:12:38:316]: callbackReceievedMessages : shouldCreate : 1
D/ONE SDK ( 1824): [2022/05/17 15:12:38:316]: _EMAChatManagerListenerImpl onReceiveMessage
D/EMChatManager( 1824): convID:124975131459585
D/EMChatManager( 1824): convID:124975131459585
D/ONE SDK ( 1824): [2022/05/17 15:12:38:644]: log: level: 1, area: 1, ChatClient::handleStatistic begin
D/ONE SDK ( 1824): [2022/05/17 15:12:38:644]: log: level: 2, area: 1, ChatClient::disconnect()
D/ONE SDK ( 1824): [2022/05/17 15:12:38:644]: log: level: 1, area: 2, cleanup() 153
D/ONE SDK ( 1824): [2022/05/17 15:12:38:644]: log: level: 1, area: 2, closeSocket() 153
D/ONE SDK ( 1824): [2022/05/17 15:12:38:644]: log: level: 2, area: 1, handleDisconnect:20
D/ONE SDK ( 1824): [2022/05/17 15:12:38:644]: EMSessionManager::onDisConnect(): 20
D/ONE SDK ( 1824): [2022/05/17 15:12:38:644]: log: level: 2, area: 1, ChatClient::disconnect()
D/ONE SDK ( 1824): [2022/05/17 15:12:38:644]: log: level: 1, area: 2, cleanup() -1
D/ONE SDK ( 1824): [2022/05/17 15:12:38:644]: log: level: 2, area: 1, handleDisconnect:14
D/ONE SDK ( 1824): [2022/05/17 15:12:38:644]: ConnUserKickedByOtherDevice
D/ONE SDK ( 1824): [2022/05/17 15:12:38:644]: begin logout ..
D/ONE SDK ( 1824): [2022/05/17 15:12:38:644]: logout complete
D/ONE SDK ( 1824): [2022/05/17 15:12:38:645]: log: level: 1, area: 1, ChatClient::handleStatistic complete
D/ONE SDK ( 1824): [2022/05/17 15:12:38:645]: getBaseServerUrl() , monitorBaseUrl : 
D/ONE SDK ( 1824): [2022/05/17 15:12:38:645]: notify state change to connection listener error code : 217
D/ONE SDK ( 1824): [2022/05/17 15:12:38:645]: EMConnectionListener onDisconnected
D/ONE SDK ( 1824): [2022/05/17 15:12:38:747]: service url is empty ! 
I/flutter ( 1824): EaseMob | V | login: baozhang367 : 123456, isPassword: true
D/ONE SDK ( 1824): [2022/05/17 15:12:38:752]: [EMClient] emchat manager login in process:1824
D/ONE SDK ( 1824): [2022/05/17 15:12:38:752]: [EMClient] emchat manager login in process:1824 threadName:pool-5-thread-56 ID:943
D/ONE SDK ( 1824): [2022/05/17 15:12:38:752]: EMSessionManager::login(): is autoLogin? 0 type: 0, id: baozhang367
D/ONE SDK ( 1824): [2022/05/17 15:12:38:752]: os version: 9
D/ONE SDK ( 1824): [2022/05/17 15:12:38:752]: buildUrl(): use default address
D/ONE SDK ( 1824): [2022/05/17 15:12:38:752]: buildUrl(): https://rs.easemob.com/easemob/server.json?sdk_version=3.9.0&app_key=1114190626168413%23baozhang&file_version=1
D/ONE SDK ( 1824): [2022/05/17 15:12:38:752]: httprequest perform: https://rs.easemob.com/easemob/server.json?sdk_version=3.9.0&app_key=1114190626168413%23baozhang&file_version=1
I/flutter ( 1824): 2022-05-17 15:12:39.275147 [ bz][ info]: 开始检查2022-05-17 15:12:39.275027
I/flutter ( 1824): 2022-05-17 15:12:40.275267 [ bz][ info]: 开始检查2022-05-17 15:12:40.275152
D/ONE SDK ( 1824): [2022/05/17 15:12:40:291]: service url is empty ! 
D/ONE SDK ( 1824): [2022/05/17 15:12:40:292]: httprequest perform: https://a1-ga.easemob.com:443/1114190626168413/baozhang/token
I/flutter ( 1824): 2022-05-17 15:12:41.274567 [ bz][ info]: 开始检查2022-05-17 15:12:41.274463
I/flutter ( 1824): 2022-05-17 15:12:42.272685 [ bz][ info]: 开始检查2022-05-17 15:12:42.272642
D/ONE SDK ( 1824): [2022/05/17 15:12:42:334]: service url is empty ! 
D/ONE SDK ( 1824): [2022/05/17 15:12:42:348]: current host: domain: a1-ga.easemob.com port: 443
D/ONE SDK ( 1824): [2022/05/17 15:12:42:349]: httprequest perform: https://a1-ga.easemob.com:443/1114190626168413/baozhang/security
I/flutter ( 1824): 2022-05-17 15:12:43.273883 [ bz][ info]: 开始检查2022-05-17 15:12:43.273809
D/ONE SDK ( 1824): [2022/05/17 15:12:44:075]: service url is empty ! 
D/ONE SDK ( 1824): [2022/05/17 15:12:44:075]: current host: domain: 35.71.128.171 port: 6717
D/ONE SDK ( 1824): [2022/05/17 15:12:44:075]: token status:  0
D/ONE SDK ( 1824): [2022/05/17 15:12:44:076]: log: level: 2, area: 1, ChatClient::connect() 
D/ONE SDK ( 1824): [2022/05/17 15:12:44:076]: log: level: 1, area: 2, connectSocket(): start to connecting...
D/ONE SDK ( 1824): [2022/05/17 15:12:44:124]: log: level: 1, area: 2, connectSocket(): connect finished
D/ONE SDK ( 1824): [2022/05/17 15:12:44:124]: log: level: 2, area: 2, connectSocket() OK: fd: 157 Client:10.0.3.15:37932 Server: 35.71.128.171:6717
D/ONE SDK ( 1824): [2022/05/17 15:12:44:125]: service url is empty ! 
I/flutter ( 1824): 2022-05-17 15:12:44.273883 [ bz][ info]: 开始检查2022-05-17 15:12:44.273771
D/ONE SDK ( 1824): [2022/05/17 15:12:44:480]: log: level: 2, area: 1, provision reason: 
D/ONE SDK ( 1824): [2022/05/17 15:12:44:481]: log: level: 2, area: 1, SEND:
D/ONE SDK ( 1824): { verison : MSYNC_V1, compress_algorimth : 0, command : UNREAD, encrypt_type : [ 0 ], payload : {  } }
D/ONE SDK ( 1824): [2022/05/17 15:12:44:481]: notify state change to connection listener error code : 0
D/ONE SDK ( 1824): [2022/05/17 15:12:44:481]: EMConnectionListener onConnected
D/ONE SDK ( 1824): [2022/05/17 15:12:44:481]: [im login time] 0: 0:405
D/ONE SDK ( 1824): [2022/05/17 15:12:44:481]: service url is empty ! 
D/ONE SDK ( 1824): [2022/05/17 15:12:44:482]: [chat login time] 0: 5:730
D/ONE SDK ( 1824): [2022/05/17 15:12:44:516]: [EMPushHelper] EMPushHelper register, prefer push type: NORMAL
D/ONE SDK ( 1824): [2022/05/17 15:12:44:517]: [EMPushHelper] Push type NORMAL no change, return. 
I/flutter ( 1824): 2022-05-17 15:12:44.521458 [ bz][ info]: 环信登录完成,开始跳转到首页
I/flutter ( 1824): 2022-05-17 15:12:44.522221 [ bz][ info]: 登录用时:24
dujiepeng commented 2 years ago

用户都是海外么?如果是海外需要和销售说明,应该会有对应的加速节点配置。

ixre commented 2 years ago

问题描述清楚了:

这个过程在某些用户网络情况下,  有用户反馈耗时过长, 本地是用梯子代理模拟出了这种情况