Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27867] FileStream.read() with a callback is not asynchronous on iOS

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterRyan Aston
AssigneeAbir Mukherjee
Created2020-04-09T19:27:18.000+0000
Updated2020-06-02T13:47:43.000+0000

Description

FileStream.read() is supposed to be an asynchronous call if invoked with a callback argument. While this works in Android, in iOS it appears to be called synchronously. This is causing our application to feel slow and even hit memory and recursion limits with large files. Attached is a sample app that demonstrates the behavior. Android 8.1.0 console output
[ERROR]  starting file read
[WARN]   ++++ 1. After Read
[WARN]   ---- 2. Reader Callback
[ERROR]  1
[WARN]   ++++ 1. After Read
[WARN]   ---- 2. Reader Callback
[ERROR]  2
[WARN]   ++++ 1. After Read
[WARN]   ---- 2. Reader Callback
[ERROR]  3
[WARN]   ++++ 1. After Read
[WARN]   ---- 2. Reader Callback
[ERROR]  4
[WARN]   ++++ 1. After Read
[WARN]   ---- 2. Reader Callback
[ERROR]  5
[WARN]   ++++ 1. After Read
[WARN]   ---- 2. Reader Callback
[ERROR]  6
[WARN]   ++++ 1. After Read
[WARN]   ---- 2. Reader Callback
[ERROR]  7
[WARN]   ++++ 1. After Read
[WARN]   ---- 2. Reader Callback
[ERROR]  8
[WARN]   ++++ 1. After Read
[WARN]   ---- 2. Reader Callback
[ERROR]  9
[WARN]   ++++ 1. After Read
[WARN]   ---- 2. Reader Callback
[WARN]   ++++ 1. After Read
[WARN]   ---- 2. Reader Callback
[ERROR]  10
[ERROR]  Done!
iOS 12.4 console output
[ERROR]  starting file read
[WARN]   ---- 2. Reader Callback
[ERROR]  1
[WARN]   ---- 2. Reader Callback
[ERROR]  2
[WARN]   ---- 2. Reader Callback
[ERROR]  3
[WARN]   ---- 2. Reader Callback
[ERROR]  4
[WARN]   ---- 2. Reader Callback
[ERROR]  5
[WARN]   ---- 2. Reader Callback
[ERROR]  6
[WARN]   ---- 2. Reader Callback
[ERROR]  7
[WARN]   ---- 2. Reader Callback
[ERROR]  8
[WARN]   ---- 2. Reader Callback
[ERROR]  9
[WARN]   ---- 2. Reader Callback
[WARN]   ---- 2. Reader Callback
[ERROR]  10
[ERROR]  Done!
[WARN]   ++++ 1. After Read
[WARN]   ++++ 1. After Read
[WARN]   ++++ 1. After Read
[WARN]   ++++ 1. After Read
[WARN]   ++++ 1. After Read
[WARN]   ++++ 1. After Read
[WARN]   ++++ 1. After Read
[WARN]   ++++ 1. After Read
[WARN]   ++++ 1. After Read
[WARN]   ++++ 1. After Read
[WARN]   ++++ 1. After Read

Attachments

FileDateSize
FileStreamAsyncBug.zip2020-04-09T19:25:36.000+00008663231

Comments

  1. Vijay Singh 2020-04-27

    [~ryan@mvretail.com] Was it working in any previous sdk in iOS ?
  2. Ryan Aston 2020-04-27

    I am not sure. We did not use this API prior to 8.0.0.
  3. Ryan Aston 2020-06-02

    Any updates on this?

JSON Source