0

I have implemented an app which allows user sending files using Nearby Connection API. But I faced problem that the connection keeps disconnected sometimes. Here is the log I got when disconnected.

12-29 10:00:37.841  1068  1148 I RilClient: initialize: commandFd is 46
12-29 10:00:37.842  1068  1148 I RilClient: start listen on fd: 23, socket name: rild-oem
12-29 10:00:37.842  1068  1098 I RmcOemHandler: requestQueryThermal Enter: -1
12-29 10:00:37.842  1068  1098 I AT      : [0] AT> AT+ETHERMAL (RIL_CMD_READER_1 tid:492184673472)
12-29 10:00:37.851  1068  1097 I AT      : [0] AT< +ETHERMAL: 2, 32767, -127, 111, 32767, 3996 (RIL_CMD_READER_1, tid:492185713856)
12-29 10:00:37.851  1068  1097 I AT      : [0] AT< OK (RIL_CMD_READER_1, tid:492185713856)
12-29 10:00:37.852  1068  1098 I RmcOemHandler: requestQueryThermal success
12-29 10:00:37.852  1068  1087 D RtcRilClientController: client 1001 handle requestComplete
12-29 10:00:37.853   777   777 I thermal_repeater: [recvMdThermalInfo] ret=33, strLen=127,  2, 32767, -127, 111, 32767, 3996
12-29 10:00:38.029  8310 23793 W Nearby  : Method is still running after 810055 millis. [CONTEXT service_id=49 ]
12-29 10:00:38.029  8310 23793 W Nearby  : ahds: ahds
12-29 10:00:38.029  8310 23793 W Nearby  :  at java.lang.Thread.sleep(Native Method)
12-29 10:00:38.029  8310 23793 W Nearby  :  at java.lang.Thread.sleep(Thread.java:442)
12-29 10:00:38.029  8310 23793 W Nearby  :  at java.lang.Thread.sleep(Thread.java:358)
12-29 10:00:38.029  8310 23793 W Nearby  :  at ahjv.a(:com.google.android.gms@204713047@20.47.13 (150406-344095733):7)
12-29 10:00:38.029  8310 23793 W Nearby  :  at ahjt.run(:com.google.android.gms@204713047@20.47.13 (150406-344095733):4)
12-29 10:00:38.029  8310 23793 W Nearby  :  at ahjv.run(:com.google.android.gms@204713047@20.47.13 (150406-344095733):3)
12-29 10:00:38.029  8310 23793 W Nearby  :  at ahdp.run(Unknown Source:0)
12-29 10:00:38.029  8310 23793 W Nearby  :  at rlt.c(:com.google.android.gms@204713047@20.47.13 (150406-344095733):6)
12-29 10:00:38.029  8310 23793 W Nearby  :  at rlt.run(:com.google.android.gms@204713047@20.47.13 (150406-344095733):7)
12-29 10:00:38.029  8310 23793 W Nearby  :  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
12-29 10:00:38.029  8310 23793 W Nearby  :  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
12-29 10:00:38.029  8310 23793 W Nearby  :  at rrp.run(:com.google.android.gms@204713047@20.47.13 (150406-344095733):0)
12-29 10:00:38.029  8310 23793 W Nearby  :  at java.lang.Thread.run(Thread.java:923)
12-29 10:00:38.029  8310 23793 W Nearby  : Caused by: ahds
12-29 10:00:38.029  8310 23793 W Nearby  :  at ahdt.a(:com.google.android.gms@204713047@20.47.13 (150406-344095733):0)
12-29 10:00:38.029  8310 23793 W Nearby  :  at ahdl.execute(:com.google.android.gms@204713047@20.47.13 (150406-344095733):0)
12-29 10:00:38.029  8310 23793 W Nearby  :  at ahjq.run(Unknown Source:6)
12-29 10:00:38.029  8310 23793 W Nearby  :  ... 7 more
12-29 10:00:38.159  8310 22681 W Nearby  : Method is still running after 810184 millis. [CONTEXT service_id=49 ]
12-29 10:00:38.159  8310 22681 W Nearby  : ahds: ahds
12-29 10:00:38.159  8310 22681 W Nearby  :  at java.net.SocketInputStream.socketRead0(Native Method)
12-29 10:00:38.159  8310 22681 W Nearby  :  at java.net.SocketInputStream.socketRead(SocketInputStream.java:119)
12-29 10:00:38.159  8310 22681 W Nearby  :  at java.net.SocketInputStream.read(SocketInputStream.java:176)
12-29 10:00:38.159  8310 22681 W Nearby  :  at java.net.SocketInputStream.read(SocketInputStream.java:144)
12-29 10:00:38.159  8310 22681 W Nearby  :  at java.io.BufferedInputStream.fill(BufferedInputStream.java:248)
12-29 10:00:38.159  8310 22681 W Nearby  :  at java.io.BufferedInputStream.read1(BufferedInputStream.java:288)
12-29 10:00:38.159  8310 22681 W Nearby  :  at java.io.BufferedInputStream.read(BufferedInputStream.java:347)
12-29 10:00:38.159  8310 22681 W Nearby  :  at java.io.DataInputStream.readFully(DataInputStream.java:198)
12-29 10:00:38.159  8310 22681 W Nearby  :  at java.io.DataInputStream.readInt(DataInputStream.java:389)
12-29 10:00:38.159  8310 22681 W Nearby  :  at ahhu.h(:com.google.android.gms@204713047@20.47.13 (150406-344095733):1)
12-29 10:00:38.159  8310 22681 W Nearby  :  at ahhu.g(:com.google.android.gms@204713047@20.47.13 (150406-344095733):2)
12-29 10:00:38.159  8310 22681 W Nearby  :  at ahjw.a(:com.google.android.gms@204713047@20.47.13 (150406-344095733):1)
12-29 10:00:38.159  8310 22681 W Nearby  :  at ahjt.run(:com.google.android.gms@204713047@20.47.13 (150406-344095733):4)
12-29 10:00:38.159  8310 22681 W Nearby  :  at ahdp.run(Unknown Source:0)
12-29 10:00:38.159  8310 22681 W Nearby  :  at rlt.c(:com.google.android.gms@204713047@20.47.13 (150406-344095733):6)
12-29 10:00:38.159  8310 22681 W Nearby  :  at rlt.run(:com.google.android.gms@204713047@20.47.13 (150406-344095733):7)
12-29 10:00:38.159  8310 22681 W Nearby  :  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
12-29 10:00:38.159  8310 22681 W Nearby  :  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
12-29 10:00:38.159  8310 22681 W Nearby  :  at rrp.run(:com.google.android.gms@204713047@20.47.13 (150406-344095733):0)
12-29 10:00:38.159  8310 22681 W Nearby  :  at java.lang.Thread.run(Thread.java:923)
12-29 10:00:38.159  8310 22681 W Nearby  : Caused by: ahds
12-29 10:00:38.159  8310 22681 W Nearby  :  at ahdt.a(:com.google.android.gms@204713047@20.47.13 (150406-344095733):0)
12-29 10:00:38.159  8310 22681 W Nearby  :  at ahdl.execute(:com.google.android.gms@204713047@20.47.13 (150406-344095733):0)
12-29 10:00:38.159  8310 22681 W Nearby  :  at ahjq.run(Unknown Source:4)
12-29 10:00:38.159  8310 22681 W Nearby  :  ... 7 more
12-29 10:00:38.194   551   551 I hwcomposer: [HWCDisplay] [Display_0 (type:1)] fps:57.555767,dur:1007.72,max:19.07,min:15.94  

More code I have. Got the log: Socket closed, but I don't know how to fix it. If anyone know how to fix, please let me know. Thank you very much.

12-29 10:00:58.826  8310 26487 I NearbyConnections: EndpointManager failed the next Read read/write for endpoint 1mhc over its ENCRYPTED_WIFI_LAN EndpointChannel. [CONTEXT service_id=54 ]
12-29 10:00:58.826  8310 26487 I NearbyConnections: java.net.SocketException: Socket closed
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at java.net.SocketInputStream.socketRead0(Native Method)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at java.net.SocketInputStream.socketRead(SocketInputStream.java:119)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at java.net.SocketInputStream.read(SocketInputStream.java:176)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at java.net.SocketInputStream.read(SocketInputStream.java:144)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at java.io.BufferedInputStream.read(BufferedInputStream.java:347)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at java.io.DataInputStream.readFully(DataInputStream.java:198)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at java.io.DataInputStream.readFully(DataInputStream.java:172)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at ahhu.h(:com.google.android.gms@204713047@20.47.13 (150406-344095733):5)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at ahhu.g(:com.google.android.gms@204713047@20.47.13 (150406-344095733):2)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at ahjw.a(:com.google.android.gms@204713047@20.47.13 (150406-344095733):1)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at ahjt.run(:com.google.android.gms@204713047@20.47.13 (150406-344095733):4)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at ahdp.run(Unknown Source:0)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at rlt.c(:com.google.android.gms@204713047@20.47.13 (150406-344095733):6)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at rlt.run(:com.google.android.gms@204713047@20.47.13 (150406-344095733):7)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at rrp.run(:com.google.android.gms@204713047@20.47.13 (150406-344095733):0)
12-29 10:00:58.826  8310 26487 I NearbyConnections:     at java.lang.Thread.run(Thread.java:923)
12-29 10:00:58.871  1173  2466 I WifiService: enableTdls uid=10137 enable=false
```12-29 10:00:58.871  1173  2466 I WifiService: enableTdls uid=10137 enable=false
12-29 10:00:58.875  1173  1430 I WifiService: enableTdlsWithMacAddress uid=1000 enable=false
12-29 10:00:58.879  8310 28920 I NearbyConnections: EndpointChannelManager unregistered endpoint 1mhc [CONTEXT service_id=54 ]
12-29 10:00:58.880  8310 26487 I NearbyConnections: EndpointManager quit overall Read loop for endpoint 1mhc because there's no EndpointChannel for it. [CONTEXT service_id=54 ]
12-29 10:00:58.883  8310 28921 I NearbyMediums: Stopped listening for incoming Wifi Lan connections. [CONTEXT service_id=54 ]
12-29 10:00:58.883  8310 26488 I NearbyConnections: ClientProxy(147530679) ignoring onConnectionResult(1mhc, ERROR) because this client has no pending connections to the endpoint [CONTEXT service_id=54 ]
12-29 10:00:58.884  8310 22681 W Nearby  : Method finished running after 830909 millis. [CONTEXT service_id=49 ]
12-29 10:00:58.884  8310 22681 W Nearby  : ahds: ahds
12-29 10:00:58.884  8310 22681 W Nearby  :  at sun.misc.Unsafe.park(Native Method)
12-29 10:00:58.884  8310 22681 W Nearby  :  at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
12-29 10:00:58.884  8310 22681 W Nearby  :  at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461)
12-29 10:00:58.884  8310 22681 W Nearby  :  at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
12-29 10:00:58.884  8310 22681 W Nearby  :  at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:937)
12-29 10:00:58.884  8310 22681 W Nearby  :  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
12-29 10:00:58.884  8310 22681 W Nearby  :  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
12-29 10:00:58.884  8310 22681 W Nearby  :  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
12-29 10:00:58.884  8310 22681 W Nearby  :  at rrp.run(:com.google.android.gms@204713047@20.47.13 (150406-344095733):0)
12-29 10:00:58.884  8310 22681 W Nearby  :  at java.lang.Thread.run(Thread.java:923)
12-29 10:00:58.884  8310 22681 W Nearby  : Caused by: ahds
12-29 10:00:58.884  8310 22681 W Nearby  :  at ahdt.a(:com.google.android.gms@204713047@20.47.13 (150406-344095733):0)
12-29 10:00:58.884  8310 22681 W Nearby  :  at ahdl.execute(:com.google.android.gms@204713047@20.47.13 (150406-344095733):0)
12-29 10:00:58.884  8310 22681 W Nearby  :  at ahjq.run(Unknown Source:4)
12-29 10:00:58.884  8310 22681 W Nearby  :  at ahdp.run(Unknown Source:0)
12-29 10:00:58.884  8310 22681 W Nearby  :  at rlt.c(:com.google.android.gms@204713047@20.47.13 (150406-344095733):6)
12-29 10:00:58.884  8310 22681 W Nearby  :  at rlt.run(:com.google.android.gms@204713047@20.47.13 (150406-344095733):7)
12-29 10:00:58.884  8310 22681 W Nearby  :  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
12-29 10:00:58.884  8310 22681 W Nearby  :  ... 3 more
12-29 10:00:58.892 26444 26444 I (NearbyReceiverService.kt:125)#onDisconnected: Stop advertising because nearby doesn't support reconnect
12-29 10:00:58.893 26444 26444 I (NearbyReceiverService.kt:187)#stopAdvertising: stop
12-29 10:00:58.894 26444 26444 D (NearbyReceiverService.kt:127)#onDisconnected: onDisconnected: 1mhc```

Please help.

  • You should provide some code, which makes it easier tracking the problem. – ChristianB Dec 29 '20 at 09:08
  • Thanks @ChristianB, i will provide some code – Nguyen Van Hanh Dec 30 '20 at 08:07
  • @Xlythe do you know the root causes? – Nguyen Van Hanh Dec 30 '20 at 08:11
  • From the logs, it looks like the connection was closed. There's not enough to tell why (and the reason might be from the remote device too). This can happen if the WiFi glitched, or devices walked too far away, the device rebooted, etc. You'll have to be resilient and reconnect. – Xlythe Jan 02 '21 at 21:08
  • Thanks @Xlythe, both device was still and very close, no rebooted happened. – Nguyen Van Hanh Jan 04 '21 at 04:10
  • @Xlythe I have more information `2021-01-13 11:28:54.865 3983-7141/? I/NearbyConnections: BandwidthUpgradeManager has processed endpoint disconnection for hsPF because there is no current BandwidthUpgradeMedium. [CONTEXT service_id=54 ]` Please help – Nguyen Van Hanh Jan 13 '21 at 04:42
  • @Xlythe More information i have ```2021-01-15 12:32:19.568 3934-14377/? I/NearbyConnections: No incoming frames were processed within the KeepAlive timeout for endpoint sVCk. [CONTEXT service_id=54 ] 2021-01-15 12:32:19.568 3934-14377/? I/NearbyConnections: EndpointManager quit overall KeepAliveManager loop for endpoint sVCk. [CONTEXT service_id=54 ] 2021-01-15 12:32:19.574 3934-14377/? I/NearbyConnections: EndpointChannelManager reported the disconnection to endpoint sVCk. [CONTEXT service_id=54 ]``` Only happen when connect both Realme and other phone on same network – Nguyen Van Hanh Jan 15 '21 at 05:39
  • There's not enough information in the logs you pasted, unfortunately. I would need a full bug report from both devices w/ WiFi Verbose Logging enabled in developer options. – Xlythe Jan 15 '21 at 05:47

0 Answers0