0

I'm working on an app that uses the Nearby Connections API which involves sending a series of large files (around 20-30 MB each). I'm using the P2P_STAR strategy as I intend to have a "master" device coordinating a group of "worker" devices, though this issue only involves two device.

Whenever I attempt to transfer some files after connecting my Samsung Galaxy S8 and Galaxy Tab S7 FE via a shared wireless access point, it inevitably leads to a disconnection. According to the logs, the issue appears to start after repeated timeouts such as this:

I/NearbyConnections: Write operation on ENCRYPTED_WIFI_LAN (isPaused: false, isClosed: false) is timeout. [CONTEXT service_id=54 ]
I/NearbyConnections: Failed to send KEEP_ALIVE frame with ack on endpoint 15SN [CONTEXT service_id=54 ]

This eventually leads to the endpoint disconnecting:

I/NearbyConnections: EndpointChannelManager unregistered endpoint 15SN [CONTEXT service_id=54 ]
I/NearbyConnections: BandwidthUpgradeManagerV2 has processed endpoint disconnection for 15SN because there is no current BandwidthUpgradeMedium. [CONTEXT service_id=54 ]
E/NearbyConnections: EndpointManager failed to find EndpointChannel over which to write DATA at offset 1048576 of Payload -4994995080558146502 to endpoint 15SN [CONTEXT service_id=54 ]

I've uploaded all of the Nearby-related message logs here.

Is there anything I can do to prevent this from occurring?

JAK Zero
  • 301
  • 6
  • 13
  • I chatted and we aren't sure what's going wrong. Can you try connected to the same access point channel (eg. both on 2.4GHz or both on 5GHz) if possible? – Xlythe Feb 28 '22 at 21:08
  • @Xlythe It seems like the issue was related to the Wi-Fi frequency band. The AP I'm using doesn't have 2.4GHz and 5GHz bands running at the same time, you have to set it to one or the other. I was initially using the 5GHz band which always led to disconnections. I then switched to 2.4GHz and it seemed to work fine, the transfers were a bit slower but it didn't disconnect at all. Do you know why it's not working with 5GHz? – JAK Zero Mar 01 '22 at 04:49
  • 5GHz has a shorter range (and doesn't go through walls as well). Do you have a good signal strength to the router from both devices? – Xlythe Mar 01 '22 at 22:11
  • The devices are right next to the router, there's only a few inches between them. To specify what I'm actually doing, the S8 is downloading video files through the router and then sending them to the tablet with Nearby Connections via Wi-Fi LAN. I guess it might be possible that the strain of downloading files and transmitting them at the same time could be causing the disconnections. It's just odd that it only seems to occur when the router is set to 5GHz and only when I use these particular devices. I'll try only transferring files and see if it still disconnects or not. – JAK Zero Mar 02 '22 at 05:34
  • @Xlythe I just tried running two tests, one where I only sent pre-downloaded videos via Nearby to be processed, and one where I downloaded and transferred videos but I disabled processing. Both of these tests completed without any disconnections. It appears as though the consistent disconnections only occur in a very specific setup where these two devices are connected via 5GHz Wi-Fi LAN, where both downloading and processing occur while transfers are made via Nearby. – JAK Zero Mar 02 '22 at 07:03
  • I don't have a good answer for that. :/ Might be hitting memory limits, but I would expect you'd see OutOfMemory crashes in the logs in that case. – Xlythe Mar 04 '22 at 03:22
  • Yeah, I haven't seen anything that indicates it's a memory issue. I guess I'll just switch the router to 2.4GHz if I ever need to use these two devices together. – JAK Zero Mar 04 '22 at 05:37
  • When building Nearby Share, we ran into an issue where the onPayloadTransferUpdate events were arriving too quickly (over 5GHz). For every event, we would update the progress bar (usually from 0.001% to 0.002%...), but the UI couldn't keep up and events kept queuing behind it until there was an OOM error. We solved it by discarding events if the progress didn't meaningfully change. But that's the closest bug I can think of to what you're seeing. – Xlythe Mar 04 '22 at 22:41

0 Answers0