Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19647] iOS: ImageViews with remote images slow and failing

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-11-19T23:28:39.000+0000
Affected Version/sRelease 4.0.0, Release 5.0.1, Release 5.0.2, Release 5.0.0
Fix Version/sRelease 5.1.0, Release 5.2.0
ComponentsiOS
LabelsImageView, Images
ReporterUriel Lizama
AssigneeHans Knöchel
Created2015-07-09T02:31:31.000+0000
Updated2016-01-20T21:38:41.000+0000

Description

This issue has been happening since version 4.0. I have a ListView with infinite scrolling that display a thumbnail loaded remotely for each thumbnail. The loading of the images is really slow, and sometimes they fail without error and will not load. This doesn't happen on SDK 3.5.1, which has all images loading correctly and at the expected speed based on my network speed an image size.

Comments

  1. Uriel Lizama 2015-09-21

    I can confirm that issue is still present on 5.0.0.GA
  2. Alfredo Mesén 2015-09-21

    +1, noticed this when updating from 3.5.1
  3. Ingo Muschenetz 2015-09-21

    Can someone add timing information that shows the difference in speed?
  4. Uriel Lizama 2015-09-21

    The issue is very very noticeable. I created a couple of comparison videos, one with an app running SDK 3.5.1.GA and the other one using the latest 5.0.0.GA. The difference is obvious, and on the latest SDKs image loading has become unusable almost. I tried to stay on 3.5.1 as long as possible just because of this, but now I don't have another choice, so I'm hoping we can fix this. *SDK 3.5.1 Image Loading* https://drive.google.com/file/d/0B8nGzMS1NSFwZi1aaldiWnladjA/view?usp=sharing *SDK 5.0.0 Image Loading* https://drive.google.com/file/d/0B8nGzMS1NSFwT2VhUFhtbm1SVFE/view?usp=sharing
  5. Jeroen van Dijk 2015-09-24

    +1, did not notice it directly. But now I've been experimenting myself as well with 3.5.1 versus 4.0.0 and up and see the difference.
  6. Uriel Lizama 2015-09-26

    I think this issue has to be set as top priority. The fact that apps can't reliably fetch remote images is a big issue. This gives a negative impact on any app built with any SDK newer than 3.5.1 and it translates into a poor user experience.
  7. Martyn Joyce 2015-09-30

    I have created a new issue with ListViews and XCode 7 which may relate to this, it would be good to know if my use case applies here. Please see: AC-438
  8. Ingo Muschenetz 2015-09-30

    Tentatively slating for next major release.
  9. Uriel Lizama 2015-09-30

    Glad to see this being moved forward. I do believe case AC-438 relates to this, as I've seen this change of behaviour as well.
  10. Hans Knöchel 2015-09-30

    [~ulizama] Can you please provide a simplified demo code to reproduce your issue? We did some internal tests and could not reproduce the issue, yet. Also make sure you have disabled the iOS9 "App Transport Security" as documented here: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Network Thank you!
  11. Uriel Lizama 2015-10-08

    I will check on the Transport Security thing and see if it changes anything, and I'll post a test code, though it will a simple ListView loading rows with image thumbnails on them.
  12. Juan Pablo Romero 2015-10-13

    Please guys fix this error, on iOS the image loading experience is very bad using the 4.x or 5.x versions of Titanium SDK.
  13. Ingo Muschenetz 2015-10-13

    [~juanblo] Can you provide a simplified demo as [~hansknoechel] requested?
  14. Uriel Lizama 2015-10-13

    I created a simple test app. Is just a listview with inifnite scroll that fetches results from an API: https://drive.google.com/file/d/0B-oU9c3d4Cn5bEZMTjRiaHlPNDg/view?usp=sharing I have been doing more tests, and the issue is more noticeable on the device itself. To test, run the app and paginate quickly so you have 20-30 images loading at a time.
  15. Hans Knöchel 2015-10-14

    We worked in the issue the last days and fixed it just today. We will continue testing and provide a solution asap.
  16. Angel Petkov 2015-10-14

    We Updated the SDK, which should fix the delay when loading the images. I've added a dropbox link with the SDK, could you please test it and see if the problem still persists? Thank you! https://www.dropbox.com/s/51y3lca28wropza/mobilesdk-5.2.0-osx.zip?dl=0 P.S.: We can include this change into the upcoming 5.1.0 release, if we get a response this week.
  17. Uriel Lizama 2015-10-14

    Downloaded the SDK. Image loading is faster, but I'm encountering app crashes:
        [DEBUG] tcp_connection_destination_perform_socket_connect 102 connectx to 2400:cb00:2048:1::681f:5b71.443@0 failed: [65] No route to host
        [DEBUG] tcp_connection_destination_perform_socket_connect 102 connectx to 2400:cb00:2048:1::681f:5a71.443@0 failed: [65] No route to host
        [DEBUG] -[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x125fc6700
        [ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
        [ERROR] Reason:
        [ERROR] -[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x125fc6700
        [ERROR] Stack trace:
        [ERROR]   
        [ERROR] 0   CoreFoundation                      0x000000018524cf5c <redacted> + 124
        [ERROR] 1   libobjc.A.dylib                     0x0000000199e43f80 objc_exception_throw + 56
        [ERROR] 2   CoreFoundation                      0x0000000185253c6c <redacted> + 0
        [ERROR] 3   CoreFoundation                      0x0000000185250c14 <redacted> + 872
        [ERROR] 4   CoreFoundation                      0x0000000185154dcc _CF_forwarding_prep_0 + 92
        [ERROR] 5   CFNetwork                           0x000000018495f1f0 <redacted> + 96
        [ERROR] 6   CFNetwork                           0x000000018495d38c <redacted> + 128
        [ERROR] 7   CFNetwork                           0x0000000184a09f00 <redacted> + 2000
        [ERROR] 8   CFNetwork                           0x0000000184a09660 <redacted> + 144
        [ERROR] 9   CFNetwork                           0x0000000184a095bc <redacted> + 360
        [ERROR] 10  CFNetwork                           0x0000000184a06d4c <redacted> + 280
        [ERROR] 11  CFNetwork                           0x0000000184a47da8 <redacted> + 72
        [ERROR] 12  CFNetwork                           0x000000018493bca0 <redacted> + 32
        [ERROR] 13  libdispatch.dylib                   0x000000019a63d770 <redacted> + 16
        [ERROR] 14  libdispatch.dylib                   0x000000019a646a54 <redacted> + 540
        [ERROR] 15  CFNetwork                           0x000000018493bc70 <redacted> + 36
        [ERROR] 16  CoreFoundation                      0x00000001851307ec CFArrayApplyFunction + 68
        [ERROR] 17  CFNetwork                           0x000000018493bb54 <redacted> + 136
        [ERROR] 18  CFNetwork                           0x000000018493ba14 <redacted> + 312
        [ERROR] 19  CFNetwork                           0x000000018493b840 <redacted> + 68
        [ERROR] 20  CoreFoundation                      0x00000001852045a4 <redacted> + 24
        [ERROR] 21  CoreFoundation                      0x0000000185204038 <redacted> + 540
        [ERROR] 22  CoreFoundation                      0x0000000185201d38 <redacted> + 724
        [ERROR] 23  CoreFoundation                      0x0000000185130dc0 CFRunLoopRunSpecific + 384
        [ERROR] 24  CFNetwork                           0x00000001849ce074 <redacted> + 412
        [ERROR] 25  Foundation                          0x000000018618b138 <redacted> + 1000
        [ERROR] 26  libsystem_pthread.dylib             0x000000019a853b3c <redacted> + 156
        [ERROR] 27  libsystem_pthread.dylib             0x000000019a853aa0 <redacted> + 0
        [ERROR] 28  libsystem_pthread.dylib             0x000000019a851030 thread_start + 4
        [ERROR] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x125fc6700'
        [ERROR] *** First throw call stack:
        [ERROR] (0x18524cf5c 0x199e43f80 0x185253c6c 0x185250c14 0x185154dcc 0x18495f1f0 0x18495d38c 0x184a09f00 0x184a09660 0x184a095bc 0x184a06d4c 0x184a47da8 0x18493bca0 0x19a63d770 0x19a646a54 0x18493bc70 0x1851307ec 0x18493bb54 0x18493ba14 0x18493b840 0x1852045a4 0x185204038 0x185201d38 0x185130dc0 0x1849ce074 0x18618b138 0x19a853b3c 0x19a853aa0 0x19a851030)
        
  18. Angel Petkov 2015-10-14

    Hi, sorry to see you're getting errors. Do these error's consist with the current master version of our SDK if you was to build the same project or is it only on 5.2.0 SDK that i sent.
  19. Uriel Lizama 2015-10-14

    So, I had been testing my app with 5.0.1.GA and haven't seen that error so far. The error did come up rather quickly in the version you sent: 5.2
  20. Angel Petkov 2015-10-14

    Hmm that's weird , could you send us the app your testing. So we can run it on 5.2 as well , to see if i encounter the same errors and if so ill try my best to fix them. Could you also test your app with the newest build (http://builds.appcelerator.com.s3.amazonaws.com/index.html#5_1_X) to see if the app crashes? It does not include the changes for now, but so we could see if the crash is related to the fix or a different issue. Also, please and send us the trace logs.
  21. Juan Pablo Romero 2015-10-14

    I've downloaded the SDK (5.2) and for me the fix works fine. My environment: * Mac OSX 10.10.4 * Appcelerator Command-Line Interface, version 5.0.3 * Alloy 1.7.16 * Xcode 7.0.1 (build 7A1001) * Node.js Version 0.10.29 * npm Version 1.4.18 * Titanium CLI Version 5.0.5 * node-appc Version 0.2.31
  22. Martyn Joyce 2015-10-15

    Thanks for your work on this guys, I can confirm that it has also fixed my issue at AC-438. I am getting a lot of indiscriminate app crashes, with no obvious error, but these also occur with the latest 5.1.x nightly build, so i assume they are unrelated.
  23. Hans Knöchel 2015-10-15

    [~juanblo] Thanks for verifying! [~ulizama] [~martz256] Can you provide a trace log to reproduce the crash? We want to make sure, that the fix does not affect the stability of other components.
  24. Juan Pablo Romero 2015-10-15

    Is possible include this fix in the next release of SDK ?
  25. Martyn Joyce 2015-10-16

    I don't get any crashes / errors when using the demo app that i created to test this issue, all works fine. My main app crashes on device only using both the nightly of 5.1.x and 5.2.0 that you sent over. I have a lot going on in that app and so cannot currently pin down where the issue is. I do not get any trace errors, the app just quits. I have a crash log from my phone at the following link, although im not sure how much help it will be. https://dl.dropboxusercontent.com/u/24724357/Scredible%20%2016-10-2015%2014-49.crash Thanks, Martyn
  26. Uriel Lizama 2015-10-16

    Hey guys, I downloaded mobilesdk-5.1.0.v20151014101225 and tested the app with that SDK. And the crash doesn't occur. I then cleaned and built with the 5.2 and the crash happened again. There is no TRACE data, just this:
        [DEBUG] -[NSTaggedPointerString __setObject:forKey:]: unrecognized selector sent to instance 0xa000000013f4b4f4
        [ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'
        [ERROR] Reason:
        [ERROR] -[NSTaggedPointerString __setObject:forKey:]: unrecognized selector sent to instance 0xa000000013f4b4f4
        [ERROR] Stack trace:
        [ERROR]   
        [ERROR] 0   CoreFoundation                      0x000000018524cf5c <redacted> + 124
        [ERROR] 1   libobjc.A.dylib                     0x0000000199e43f80 objc_exception_throw + 56
        [ERROR] 2   CoreFoundation                      0x0000000185253c6c <redacted> + 0
        [ERROR] 3   CoreFoundation                      0x0000000185250c14 <redacted> + 872
        [ERROR] 4   CoreFoundation                      0x0000000185154dcc _CF_forwarding_prep_0 + 92
        [ERROR] 5   CFNetwork                           0x000000018495f254 <redacted> + 196
        [ERROR] 6   CFNetwork                           0x000000018495d38c <redacted> + 128
        [ERROR] 7   CFNetwork                           0x0000000184a09f00 <redacted> + 2000
        [ERROR] 8   CFNetwork                           0x0000000184a09660 <redacted> + 144
        [ERROR] 9   CFNetwork                           0x0000000184a0b30c <redacted> + 28
        [ERROR] 10  libdispatch.dylib                   0x000000019a63d770 <redacted> + 16
        [ERROR] 11  libdispatch.dylib                   0x000000019a646a54 <redacted> + 540
        [ERROR] 12  CFNetwork                           0x000000018493bc70 <redacted> + 36
        [ERROR] 13  CoreFoundation                      0x00000001851307ec CFArrayApplyFunction + 68
        [ERROR] 14  CFNetwork                           0x000000018493bb54 <redacted> + 136
        [ERROR] 15  CFNetwork                           0x000000018493ba14 <redacted> + 312
        [ERROR] 16  CFNetwork                           0x000000018493b840 <redacted> + 68
        [ERROR] 17  CoreFoundation                      0x00000001852045a4 <redacted> + 24
        [ERROR] 18  CoreFoundation                      0x0000000185204038 <redacted> + 540
        [ERROR] 19  CoreFoundation                      0x0000000185201d38 <redacted> + 724
        [ERROR] 20  CoreFoundation                      0x0000000185130dc0 CFRunLoopRunSpecific + 384
        [ERROR] 21  CFNetwork                           0x00000001849ce074 <redacted> + 412
        [ERROR] 22  Foundation                          0x000000018618b138 <redacted> + 1000
        [ERROR] 23  libsystem_pthread.dylib             0x000000019a853b3c <redacted> + 156
        [ERROR] 24  libsystem_pthread.dylib             0x000000019a853aa0 <redacted> + 0
        [ERROR] 25  libsystem_pthread.dylib             0x000000019a851030 thread_start + 4
        [ERROR] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString __setObject:forKey:]: unrecognized selector sent to instance 0xa000000013f4b4f4'
        [ERROR] *** First throw call stack:
        [ERROR] (0x18524cf5c 0x199e43f80 0x185253c6c 0x185250c14 0x185154dcc 0x18495f254 0x18495d38c 0x184a09f00 0x184a09660 0x184a0b30c 0x19a63d770 0x19a646a54 0x18493bc70 0x1851307ec 0x18493bb54 0x18493ba14 0x18493b840 0x1852045a4 0x185204038 0x185201d38 0x185130dc0 0x1849ce074 0x18618b138 0x19a853b3c 0x19a853aa0 0x19a851030)
        
    Some things I noticed: 1. The crash happens randomly, but it seems to happen whenever I start a new http request to load more items on the infinite scroll. 2. The http request to load more items, seems to be blocked until all the previous images have been loaded, I don't know if this is the intended behaviour, but I would assume that http requests should take precedence on loading the images. Thanks for your all help.
  27. Hans Knöchel 2015-10-17

    Hi everyone! We discussed the solution internally. First of all, the crashes above don't look like being related to the list view change, so please file tickets, if you can define a component, that causes the crash. Regarding the list view remote images, we will not change the default behavior, but introduce a new property lazyLoadingEnabled which is true by default. That means, that images are loaded as soon as they come into the visible area like it is now. If you want to load images even if they are not in the visible area (which reflects the fix we provided above), you can then set lazyLoadingEnabled to false. Is everyone good with this solution? We would then get it into the upcoming 5.1 SDK release. Feedback appreciated! P.S.: The property will be available for Ti.UI.ListView on iOS.
  28. Juan Pablo Romero 2015-10-17

    Thank you very so much Hans for this fix. From my point of view this solution is right. To testing what version (or branch) of SDK can we use ?
  29. Uriel Lizama 2015-10-17

    Thanks! I really like that solution ;)
  30. Martyn Joyce 2015-10-19

    Thanks, thats a great solution! Getting it into 5.1 is also a massive thumbs up!
  31. emanuele de cupis 2015-10-19

    I experienced this wrong behaviour as well, here's my thoughts. I have a TableView, in each TableViewRow I have a ImageView that loads an image from a url. The app crashes with *nothing in logs*. Here what I discovered after some investigation: * The issue happens with SDK 4.x.GA and 5.0.x.GA. On 5.2.0 still happens, but less frequently. * As far as I understood, the issue is somewhat related to the delay for downloading the image. Thus is more frequent when using a 3g connection instead of WiFi, or when the image is slightly bigger. Anyway, the sample app provided from Uriel Lizama works fine for me with all the previous sdk. I hope this few thoughts can help
  32. emanuele de cupis 2015-10-20

    After some further investigation, I came out with a crash log from my device. Here an excerpt: {panel} OS Version: iOS 8.1.3 (12B466) Report Version: 105 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000c Triggered by Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libobjc.A.dylib 0x3209ef46 objc_msgSend + 6 1 XXXYYYZZZ 0x0020a158 +[TiLayoutQueue layoutProxy:] (TiLayoutQueue.m:78) 2 XXXYYYZZZ 0x00209fb8 performLayoutRefresh (TiLayoutQueue.m:46) 3 CoreFoundation 0x2485ec84 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 12 4 CoreFoundation 0x2485e7fe __CFRunLoopDoTimer + 646 5 CoreFoundation 0x2485ca4e __CFRunLoopRun + 1414 6 CoreFoundation 0x247aa3bc CFRunLoopRunSpecific + 472 7 CoreFoundation 0x247aa1ce CFRunLoopRunInMode + 102 8 GraphicsServices 0x2bba80a4 GSEventRunModal + 132 9 UIKit 0x27db87ac UIApplicationMain + 1436 10 XXXYYYZZZ 0x0008603e main (main.m:37) 11 libdyld.dylib 0x32612aac start + 0 Thread 0 crashed with ARM Thread State (32-bit): r0: 0x1541ac00 r1: 0x00534c87 r2: 0x1541ac00 r3: 0x3209ef41 r4: 0x00000020 r5: 0x007d5bf4 r6: 0x007d5c80 r7: 0x007d5b98 r8: 0x34d94074 r9: 0x00000000 r10: 0x14e845a0 r11: 0x14d47a50 ip: 0x0020a131 sp: 0x007d5b84 lr: 0x0020a15b pc: 0x3209ef46 cpsr: 0x600f0030 {panel} (XXXYYYZZZ is my app)
  33. Hans Knöchel 2015-10-21

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/7320 PR (5_1_X): https://github.com/appcelerator/titanium_mobile/pull/7329
  34. Nuno Costa 2015-10-22

    wow what I improvement, just tested. Thanks.
  35. Martyn Joyce 2015-10-23

    FYI I found the cause of my crashes to be TIMOB-19682 javascript executing on the main thread, this was fixed following the notes here: https://github.com/appcelerator/titanium_mobile/pull/6891 I hope this will help others who are having issues. This ListView update is working perfectly, thanks
  36. Hans Knöchel 2015-10-23

  37. Eric Wieber 2015-10-29

    Verified fixed, using: MacOS 10.11.2 (15C27e) Studio 4.4.0.201510280736 Ti SDK 5.1.0.v20151028190028 Appc NPM 4.2.1 Appc CLI 5.1.0-38 Ti CLI 5.0.5 Alloy 1.7.16 Arrow 1.3.13 Xcode 7.2 (7C46l) Node v0.12.7 Java 1.7.0_80 production Used the sample code to test load times/errors on remote images, with lazyLoadingEnabled set to true and false. Loading was very responsive and the new property works as intended.

JSON Source