Highlighted

AIR iOS hard crashes: wakeup - Observed 503/sec over 300 secs

Community Beginner ,
Feb 26, 2015

Copy link to clipboard

Copied

Hi,

for a project I had to download a file with around 3GB.

So I decided to write a chunk based download controller, which easily does the following:

- open an URLStream

- Load the file by URLRequest

- Wait for the progress events and check, that we have more than 5MB in the buffer

- Write the bytes to an local file by using an Bytearray+Filestream combination

Additional I have implemented a workaround for the file size limit regarding to the Android specs,

that the local files is chunked when, the file exceeds the file size limit.

This solution works fine in this cases / test systems:

- Desktop - Windows

- Desktop - Mac

- Android - Debug

- Android - Release

- iOS 8.1.3 - Debug - fast interpreter mode


But when I try to compile and run / debug the app for iOS with the following modes:

- Release build Store

- Release build AdHoc

- Debug build without fast interpreter


The app crashes hard during the download.


I isolated my download controller and created a simple test app, which is using a simple sprite

and runs the download controller.


During the download the app is not completely hard crashing but the xcode console detects 1-2 crashes:


Feb 25 09:57:29 iPad-mini ReportCrash[422] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)

Feb 25 09:57:29 iPad-mini ReportCrash[422] <Notice>: ReportCrash acting against PID 421

Feb 25 09:57:29 iPad-mini ReportCrash[422] <Notice>: Formulating crash report for process DownloadAndTarUnitTester[421]

Feb 25 09:57:30 iPad-mini ReportCrash[422] <Notice>: Saved report to /var/mobile/Library/Logs/CrashReporter/ExcResource_DownloadAndTarUnitTester_2015-02-25-095729_iPad-mini.ips


Relating crash report:


Incident Identifier: 868898CC-9DAF-422E-889C-F397C2595E8F

CrashReporter Key:   eb14103bfc730ebe68f5b1970597c35e3006eb42

Hardware Model:      iPad2,5

Process:             DownloadAndTarUnitTester [421]

Path:                /private/var/mobile/Containers/Bundle/Application/7F892804-5378-4B81-BE54-C1EDA66FCF96/DownloadAndTarUnitTester.app/DownloadAndTarUnitTester

Identifier:          DownloadAndTarUnitTester

Version:             0.0.0 (0.0.0)

Code Type:           ARM (Native)

Parent Process:      launchd [1]

Date/Time:           2015-02-25 09:57:29.864 +0100

Launch Time:         2015-02-25 09:56:48.087 +0100

OS Version:          iOS 8.1.3 (12B466)

Report Version:      105

Exception Type:  EXC_RESOURCE

Exception Subtype: WAKEUPS

Exception Message: (Limit 150/sec) Observed 1079/sec over 300 secs

Triggered by Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread

Thread 0 Attributed:

0   libsystem_pthread.dylib       0x3a1a2eba 0x3a1a2000 + 3770

1   CoreFoundation                 0x2befeb68 0x2be32000 + 838504

2   CoreFoundation                 0x2be4bb2c CFRunLoopRunSpecific + 472

3   CoreFoundation                 0x2be4b93e CFRunLoopRunInMode + 102

4   GraphicsServices               0x3320004c 0x331f7000 + 36940

5   UIKit                         0x2f43df1c 0x2f3d0000 + 450332

6   DownloadAndTarUnitTester       0x0026761c 0x57000 + 2164252

7   DownloadAndTarUnitTester       0x006ca730 0x57000 + 6764336

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager

Thread 1:

0   libsystem_kernel.dylib         0x3a1122c8 kevent64 + 24

1   libdispatch.dylib             0x3a034e44 _dispatch_mgr_invoke + 276

2   libdispatch.dylib             0x3a034b76 _dispatch_mgr_thread$VARIANT$mp + 34

Thread 2 name:  BackgroundThread

Thread 2:

0   libsystem_kernel.dylib         0x3a125b38 __psynch_cvwait + 24

1   libsystem_pthread.dylib       0x3a1a43dc _pthread_cond_wait + 516

2   libsystem_pthread.dylib       0x3a1a52ac pthread_cond_wait + 36

3   DownloadAndTarUnitTester       0x0041dd90 0x57000 + 3960208

4   DownloadAndTarUnitTester       0x002fbe78 0x57000 + 2772600

5   DownloadAndTarUnitTester       0x0041db60 0x57000 + 3959648

6   DownloadAndTarUnitTester       0x0041dbb4 0x57000 + 3959732

7   DownloadAndTarUnitTester       0x0041d8d4 0x57000 + 3958996

8   libsystem_pthread.dylib       0x3a1a4e64 _pthread_body + 136

9   libsystem_pthread.dylib       0x3a1a4dd6 _pthread_start + 114

10  libsystem_pthread.dylib       0x3a1a2b80 thread_start + 4

Thread 3 name:  BackgroundThread

Thread 3:

0   libsystem_kernel.dylib         0x3a125b38 __psynch_cvwait + 24

1   libsystem_pthread.dylib       0x3a1a43dc _pthread_cond_wait + 516

2   libsystem_pthread.dylib       0x3a1a52ac pthread_cond_wait + 36

3   DownloadAndTarUnitTester       0x0041dd90 0x57000 + 3960208

4   DownloadAndTarUnitTester       0x002fbe78 0x57000 + 2772600

5   DownloadAndTarUnitTester       0x0041db60 0x57000 + 3959648

6   DownloadAndTarUnitTester       0x0041dbb4 0x57000 + 3959732

7   DownloadAndTarUnitTester       0x0041d8d4 0x57000 + 3958996

8   libsystem_pthread.dylib       0x3a1a4e64 _pthread_body + 136

9   libsystem_pthread.dylib       0x3a1a4dd6 _pthread_start + 114

10  libsystem_pthread.dylib       0x3a1a2b80 thread_start + 4

Thread 4:

0   libsystem_kernel.dylib         0x3a12619c __semwait_signal + 24

1   libsystem_c.dylib             0x3a085de0 nanosleep + 168

2   DownloadAndTarUnitTester       0x0041d93c 0x57000 + 3959100

3   DownloadAndTarUnitTester       0x0028578c 0x57000 + 2287500

4   DownloadAndTarUnitTester       0x0028574c 0x57000 + 2287436

5   DownloadAndTarUnitTester       0x0041db60 0x57000 + 3959648

6   DownloadAndTarUnitTester       0x0041dbb4 0x57000 + 3959732

7   DownloadAndTarUnitTester       0x0041d8d4 0x57000 + 3958996

8   libsystem_pthread.dylib       0x3a1a4e64 _pthread_body + 136

9   libsystem_pthread.dylib       0x3a1a4dd6 _pthread_start + 114

10  libsystem_pthread.dylib       0x3a1a2b80 thread_start + 4

[...]




Feb 25 09:59:54 iPad-mini ReportCrash[440] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)

Feb 25 09:59:54 iPad-mini ReportCrash[440] <Notice>: ReportCrash acting against PID 436

Feb 25 09:59:54 iPad-mini ReportCrash[440] <Notice>: Formulating crash report for process DownloadAndTarUnitTester[436]

Feb 25 09:59:55 iPad-mini ReportCrash[440] <Notice>: Saved report to /var/mobile/Library/Logs/CrashReporter/ExcResource_DownloadAndTarUnitTester_2015-02-25-095954_iPad-mini.ips

Relating crash report:

CrashReporter Key:   eb14103bfc730ebe68f5b1970597c35e3006eb42

Hardware Model:      iPad2,5

Process:             DownloadAndTarUnitTester [436]

Path:                /private/var/mobile/Containers/Bundle/Application/7A313D06-6D0C-4583-8CCA-C0994F6BCAB0/DownloadAndTarUnitTester.app/DownloadAndTarUnitTester

Identifier:          DownloadAndTarUnitTester

Version:             0.0.0 (0.0.0)

Code Type:           ARM (Native)

Parent Process:      launchd [1]

Date/Time:           2015-02-25 09:59:54.603 +0100

Launch Time:         2015-02-25 09:58:25.203 +0100

OS Version:          iOS 8.1.3 (12B466)

Report Version:      105

Exception Type:  EXC_RESOURCE

Exception Subtype: WAKEUPS

Exception Message: (Limit 150/sec) Observed 503/sec over 300 secs

Triggered by Thread:  12

Thread 0 name:  Dispatch queue: com.apple.main-thread

Thread 0:

0   libsystem_kernel.dylib         0x3a112518 mach_msg_trap + 20

1   libsystem_kernel.dylib         0x3a11230c mach_msg + 36

2   CoreFoundation                 0x2bf00596 __CFRunLoopServiceMachPort + 142

3   CoreFoundation                 0x2befeb5c __CFRunLoopRun + 1012

4   CoreFoundation                 0x2be4bb2c CFRunLoopRunSpecific + 472

5   CoreFoundation                 0x2be4b93e CFRunLoopRunInMode + 102

6   GraphicsServices               0x3320004c GSEventRunModal + 132

7   UIKit                         0x2f43df1c UIApplicationMain + 1436

8   DownloadAndTarUnitTester       0x002da61c 0xca000 + 2164252

9   DownloadAndTarUnitTester       0x0073d730 0xca000 + 6764336

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager

Thread 1:

0   libsystem_kernel.dylib         0x3a1122c8 kevent64 + 24

1   libdispatch.dylib             0x3a034e44 _dispatch_mgr_invoke + 276

2   libdispatch.dylib             0x3a034b76 _dispatch_mgr_thread$VARIANT$mp + 34

Thread 2:

0   libsystem_kernel.dylib         0x3a1269cc __workq_kernreturn + 8

1   libsystem_pthread.dylib       0x3a1a2e9c _pthread_wqthread + 788

2   libsystem_pthread.dylib       0x3a1a2b74 start_wqthread + 4

[...]

The debugger did not detect any error.

I tested AIR 15, 16.


Maybe this is a iOS restriction regarding to the new battery consumption limitations for apps.

So I tried to:

- Set the framerate to max. 30FPS

- Extend to buffer size before write to test on ProgressEvent form 512KB to 5MB

But the crashes are staying and the observed wakeups are not reducing.



Has anyone an idea how to solve this?


This seems to be due to a mismatch between new iOS battery conservation policy and the way AIR handles async stream operations.

I have opened a bug report about this: Bug#4006324 - Asynchronous URLStream and FileStream operation generate system wakeup calls over the iOS limit

TOPICS
Performance issues

Views

3.1K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

AIR iOS hard crashes: wakeup - Observed 503/sec over 300 secs

Community Beginner ,
Feb 26, 2015

Copy link to clipboard

Copied

Hi,

for a project I had to download a file with around 3GB.

So I decided to write a chunk based download controller, which easily does the following:

- open an URLStream

- Load the file by URLRequest

- Wait for the progress events and check, that we have more than 5MB in the buffer

- Write the bytes to an local file by using an Bytearray+Filestream combination

Additional I have implemented a workaround for the file size limit regarding to the Android specs,

that the local files is chunked when, the file exceeds the file size limit.

This solution works fine in this cases / test systems:

- Desktop - Windows

- Desktop - Mac

- Android - Debug

- Android - Release

- iOS 8.1.3 - Debug - fast interpreter mode


But when I try to compile and run / debug the app for iOS with the following modes:

- Release build Store

- Release build AdHoc

- Debug build without fast interpreter


The app crashes hard during the download.


I isolated my download controller and created a simple test app, which is using a simple sprite

and runs the download controller.


During the download the app is not completely hard crashing but the xcode console detects 1-2 crashes:


Feb 25 09:57:29 iPad-mini ReportCrash[422] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)

Feb 25 09:57:29 iPad-mini ReportCrash[422] <Notice>: ReportCrash acting against PID 421

Feb 25 09:57:29 iPad-mini ReportCrash[422] <Notice>: Formulating crash report for process DownloadAndTarUnitTester[421]

Feb 25 09:57:30 iPad-mini ReportCrash[422] <Notice>: Saved report to /var/mobile/Library/Logs/CrashReporter/ExcResource_DownloadAndTarUnitTester_2015-02-25-095729_iPad-mini.ips


Relating crash report:


Incident Identifier: 868898CC-9DAF-422E-889C-F397C2595E8F

CrashReporter Key:   eb14103bfc730ebe68f5b1970597c35e3006eb42

Hardware Model:      iPad2,5

Process:             DownloadAndTarUnitTester [421]

Path:                /private/var/mobile/Containers/Bundle/Application/7F892804-5378-4B81-BE54-C1EDA66FCF96/DownloadAndTarUnitTester.app/DownloadAndTarUnitTester

Identifier:          DownloadAndTarUnitTester

Version:             0.0.0 (0.0.0)

Code Type:           ARM (Native)

Parent Process:      launchd [1]

Date/Time:           2015-02-25 09:57:29.864 +0100

Launch Time:         2015-02-25 09:56:48.087 +0100

OS Version:          iOS 8.1.3 (12B466)

Report Version:      105

Exception Type:  EXC_RESOURCE

Exception Subtype: WAKEUPS

Exception Message: (Limit 150/sec) Observed 1079/sec over 300 secs

Triggered by Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread

Thread 0 Attributed:

0   libsystem_pthread.dylib       0x3a1a2eba 0x3a1a2000 + 3770

1   CoreFoundation                 0x2befeb68 0x2be32000 + 838504

2   CoreFoundation                 0x2be4bb2c CFRunLoopRunSpecific + 472

3   CoreFoundation                 0x2be4b93e CFRunLoopRunInMode + 102

4   GraphicsServices               0x3320004c 0x331f7000 + 36940

5   UIKit                         0x2f43df1c 0x2f3d0000 + 450332

6   DownloadAndTarUnitTester       0x0026761c 0x57000 + 2164252

7   DownloadAndTarUnitTester       0x006ca730 0x57000 + 6764336

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager

Thread 1:

0   libsystem_kernel.dylib         0x3a1122c8 kevent64 + 24

1   libdispatch.dylib             0x3a034e44 _dispatch_mgr_invoke + 276

2   libdispatch.dylib             0x3a034b76 _dispatch_mgr_thread$VARIANT$mp + 34

Thread 2 name:  BackgroundThread

Thread 2:

0   libsystem_kernel.dylib         0x3a125b38 __psynch_cvwait + 24

1   libsystem_pthread.dylib       0x3a1a43dc _pthread_cond_wait + 516

2   libsystem_pthread.dylib       0x3a1a52ac pthread_cond_wait + 36

3   DownloadAndTarUnitTester       0x0041dd90 0x57000 + 3960208

4   DownloadAndTarUnitTester       0x002fbe78 0x57000 + 2772600

5   DownloadAndTarUnitTester       0x0041db60 0x57000 + 3959648

6   DownloadAndTarUnitTester       0x0041dbb4 0x57000 + 3959732

7   DownloadAndTarUnitTester       0x0041d8d4 0x57000 + 3958996

8   libsystem_pthread.dylib       0x3a1a4e64 _pthread_body + 136

9   libsystem_pthread.dylib       0x3a1a4dd6 _pthread_start + 114

10  libsystem_pthread.dylib       0x3a1a2b80 thread_start + 4

Thread 3 name:  BackgroundThread

Thread 3:

0   libsystem_kernel.dylib         0x3a125b38 __psynch_cvwait + 24

1   libsystem_pthread.dylib       0x3a1a43dc _pthread_cond_wait + 516

2   libsystem_pthread.dylib       0x3a1a52ac pthread_cond_wait + 36

3   DownloadAndTarUnitTester       0x0041dd90 0x57000 + 3960208

4   DownloadAndTarUnitTester       0x002fbe78 0x57000 + 2772600

5   DownloadAndTarUnitTester       0x0041db60 0x57000 + 3959648

6   DownloadAndTarUnitTester       0x0041dbb4 0x57000 + 3959732

7   DownloadAndTarUnitTester       0x0041d8d4 0x57000 + 3958996

8   libsystem_pthread.dylib       0x3a1a4e64 _pthread_body + 136

9   libsystem_pthread.dylib       0x3a1a4dd6 _pthread_start + 114

10  libsystem_pthread.dylib       0x3a1a2b80 thread_start + 4

Thread 4:

0   libsystem_kernel.dylib         0x3a12619c __semwait_signal + 24

1   libsystem_c.dylib             0x3a085de0 nanosleep + 168

2   DownloadAndTarUnitTester       0x0041d93c 0x57000 + 3959100

3   DownloadAndTarUnitTester       0x0028578c 0x57000 + 2287500

4   DownloadAndTarUnitTester       0x0028574c 0x57000 + 2287436

5   DownloadAndTarUnitTester       0x0041db60 0x57000 + 3959648

6   DownloadAndTarUnitTester       0x0041dbb4 0x57000 + 3959732

7   DownloadAndTarUnitTester       0x0041d8d4 0x57000 + 3958996

8   libsystem_pthread.dylib       0x3a1a4e64 _pthread_body + 136

9   libsystem_pthread.dylib       0x3a1a4dd6 _pthread_start + 114

10  libsystem_pthread.dylib       0x3a1a2b80 thread_start + 4

[...]




Feb 25 09:59:54 iPad-mini ReportCrash[440] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)

Feb 25 09:59:54 iPad-mini ReportCrash[440] <Notice>: ReportCrash acting against PID 436

Feb 25 09:59:54 iPad-mini ReportCrash[440] <Notice>: Formulating crash report for process DownloadAndTarUnitTester[436]

Feb 25 09:59:55 iPad-mini ReportCrash[440] <Notice>: Saved report to /var/mobile/Library/Logs/CrashReporter/ExcResource_DownloadAndTarUnitTester_2015-02-25-095954_iPad-mini.ips

Relating crash report:

CrashReporter Key:   eb14103bfc730ebe68f5b1970597c35e3006eb42

Hardware Model:      iPad2,5

Process:             DownloadAndTarUnitTester [436]

Path:                /private/var/mobile/Containers/Bundle/Application/7A313D06-6D0C-4583-8CCA-C0994F6BCAB0/DownloadAndTarUnitTester.app/DownloadAndTarUnitTester

Identifier:          DownloadAndTarUnitTester

Version:             0.0.0 (0.0.0)

Code Type:           ARM (Native)

Parent Process:      launchd [1]

Date/Time:           2015-02-25 09:59:54.603 +0100

Launch Time:         2015-02-25 09:58:25.203 +0100

OS Version:          iOS 8.1.3 (12B466)

Report Version:      105

Exception Type:  EXC_RESOURCE

Exception Subtype: WAKEUPS

Exception Message: (Limit 150/sec) Observed 503/sec over 300 secs

Triggered by Thread:  12

Thread 0 name:  Dispatch queue: com.apple.main-thread

Thread 0:

0   libsystem_kernel.dylib         0x3a112518 mach_msg_trap + 20

1   libsystem_kernel.dylib         0x3a11230c mach_msg + 36

2   CoreFoundation                 0x2bf00596 __CFRunLoopServiceMachPort + 142

3   CoreFoundation                 0x2befeb5c __CFRunLoopRun + 1012

4   CoreFoundation                 0x2be4bb2c CFRunLoopRunSpecific + 472

5   CoreFoundation                 0x2be4b93e CFRunLoopRunInMode + 102

6   GraphicsServices               0x3320004c GSEventRunModal + 132

7   UIKit                         0x2f43df1c UIApplicationMain + 1436

8   DownloadAndTarUnitTester       0x002da61c 0xca000 + 2164252

9   DownloadAndTarUnitTester       0x0073d730 0xca000 + 6764336

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager

Thread 1:

0   libsystem_kernel.dylib         0x3a1122c8 kevent64 + 24

1   libdispatch.dylib             0x3a034e44 _dispatch_mgr_invoke + 276

2   libdispatch.dylib             0x3a034b76 _dispatch_mgr_thread$VARIANT$mp + 34

Thread 2:

0   libsystem_kernel.dylib         0x3a1269cc __workq_kernreturn + 8

1   libsystem_pthread.dylib       0x3a1a2e9c _pthread_wqthread + 788

2   libsystem_pthread.dylib       0x3a1a2b74 start_wqthread + 4

[...]

The debugger did not detect any error.

I tested AIR 15, 16.


Maybe this is a iOS restriction regarding to the new battery consumption limitations for apps.

So I tried to:

- Set the framerate to max. 30FPS

- Extend to buffer size before write to test on ProgressEvent form 512KB to 5MB

But the crashes are staying and the observed wakeups are not reducing.



Has anyone an idea how to solve this?


This seems to be due to a mismatch between new iOS battery conservation policy and the way AIR handles async stream operations.

I have opened a bug report about this: Bug#4006324 - Asynchronous URLStream and FileStream operation generate system wakeup calls over the iOS limit

TOPICS
Performance issues

Views

3.1K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 26, 2015 2
New Here ,
Jun 12, 2015

Copy link to clipboard

Copied

This seems to be due to a mismatch between new iOS battery conservation policy and the way AIR handles async stream operations.

I have opened a bug report about this: Bug#4006324 - Asynchronous URLStream and FileStream operation generate system wakeup calls over the ...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 12, 2015 0
Community Beginner ,
Jun 24, 2015

Copy link to clipboard

Copied

Hi,

thanks for this details.

I have voted for your bug report, also I have added comment with link to your ticket within my bug report:

Bug#3945617 - hard crashes: wakeup - Observed 503/sec over 300 secs

Hope Adobe can fix this soon, before Apple starts to reject apps because of this issue.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 24, 2015 0