EASession's InputStream hangs on iOS 11 (unusable)
| Originator: | jeff | ||
| Number: | rdar://34431044 | Date Originated: | 09/14/17 |
| Status: | Open (Duplicate 33955993) | Resolved: | N/A |
| Product: | iOS | Product Version: | 11.0 - 11.1 Beta |
| Classification: | Bug | Reproducible: | Always |
Area: External Accessory Framework Summary: We produce an IAP2 Bluetooth accessory (www.beartooth.com). On the iOS 11 GM, the InputStream provided by the accessory's EASession frequently hangs, rendering our app unusable (we rely on low latency I/O with the accessory). The hangs occur regardless of whether we schedule the stream in a RunLoop or use polling. It appears to be related to the `hasBytesAvailable` property/stream event. When using RunLoop scheduling, we attempt to read an arbitrary amount of data from the InputStream after consuming the `hasBytesAvailable` stream event. The first read works as expected, but no subsequent `hasBytesAvailable` events are fired. When polling, we read from the stream while the `hasBytesAvailable` property returns true, spinning otherwise. Similarly to the RunLoop approach, the first read appears to succeed. After the first read, the reader thread appears to be hung up trying to access the `hasBytesAvailable` property. This behavior seems indicative of some kind of internal spin lock that is misbehaving. I have confirmed that this issue does not occur on iOS 10.3.3. Due to the dependence on our specific MFi accessory, I have not included any sample projects/code. I do not believe this problem lies with the accessory itself, as our latest release of both application and firmware works as intended on iOS 10. I can tell the accessory is attempting to respond to requests on the Bluetooth link, as it will eventually crash our firmware due to buffer overflow if the app is left running in a hung state. Steps to Reproduce: Connect with a Beartooth on the iOS 11 GM build, and attempt to read data from the EASession's InputStream instance (using polling or RunLoop scheduling) Expected Results: The InputStream produces accessory data as expected. Actual Results: The InputStream frequently hangs during reads for several seconds or indefinitely. Version/Build: iOS 11 GM (Build 15A372) Configuration: Test Devices: iPhone 5S, iPhone 6, iPhone 6 Plus, iPhone 7 Toolchains: Xcode 9 GM Seed, Jetbrains AppCode 2017.3 Swift Source Version: 4.0 MFi Accessory: Beartooth MK1
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!