iOS Question App crashed due to CPU over usage

AneeshJay

Member
Licensed User
Hi All,
I have this weird issue where the app keeps crashing randomly. I had the client email me the device logs(https://www.b4x.com/android/forum/threads/tip-on-device-logs.156056/#content). Below is one from the logs. From the below crash log, and from doing some research online, I learned that the app is being killed by the OS for extensive CPU usage and that I could find the runaway code by symbolicating the crash report.

[CODE lang="b4x" title="AiPOSX_cpu_resource"]{"roots_installed":0,"app_name":"Ai-POSX","timestamp":"2024-12-12 10:20:06.00 +1000","app_version":"4.22","slice_uuid":"3C64164C-5334-35B7-92EB-1BF3D1BF4AC6","adam_id":"6469747360","build_version":"4.22","bundleID":"b4i.AiPOSX","duration_ms":"179193","is_first_party":0,"share_with_app_devs":0,"bug_type":"202","os_version":"iPhone OS 18.1.1 (22B91)","distributor_id":"com.apple.AppStore","name":"Ai-POSX","incident_id":"44308A0D-A500-4236-A695-40F597A235DE"}
Date/Time: 2024-12-12 10:17:05.298 +1000
End time: 2024-12-12 10:20:04.492 +1000
OS Version: iPhone OS 18.1.1 (Build 22B91)
Architecture: arm64e
Report Version: 53
Incident Identifier: 44308A0D-A500-4236-A695-40F597A235DE

Data Source: Microstackshots
Shared Cache: 5341F4EE-8AA5-3EE6-A94B-D088748566C5 slid base address 0x18faa0000, slide 0xfaa0000

Command: Ai-POSX
Path: /private/var/containers/Bundle/Application/C5A077D2-4843-45BA-8434-15CF5047F002/Ai-POSX.app/Ai-POSX
Identifier: b4i.AiPOSX
Version: 4.22 (4.22)
Adam ID: 6469747360
Is First Party: No
Beta Identifier: B6678C13-709E-4D2A-9AAE-3CBF70C91FE4
Resource Coalition: "b4i.AiPOSX"(2052)
Architecture: arm64
Parent: UNKNOWN [1]
PID: 3566

Event: cpu usage
Action taken: none
CPU: 90 seconds cpu time over 179 seconds (50% cpu average), exceeding limit of 50% cpu over 180 seconds
CPU limit: 90s
Limit duration: 180s
CPU used: 90s
CPU duration: 179s
Duration: 179.19s
Duration Sampled: 178.35s (event ends 0.70s after samples)
Steps: 157

Hardware model: iPad13,16
Active cpus: 8
HW page size: 16384
VM page size: 16384

Time Since Boot: 748557s
Time Awake Since Boot: 680130s
Time Since Wake: 5325s

Total CPU Time: 94.089s
Advisory levels: Battery -> 2, User -> 3, ThermalPressure -> 0, Combined -> 2
Free disk space: 30.67 GB/59.59 GB, low space threshold 150 MB
Vnodes Available: 58.10% (11621/20000, 10000 allocated, 10000 soft limit)

Preferred User Language: en-AU
Country Code: AU
Keyboards: en_AU QWERTY, emoji Emoji
OS Cryptex File Extents: 1

Heaviest stack for the target process:
144 ??? (dyld + 212680) [0x1b82a2ec8]
144 ??? (Ai-POSX + 32868) [0x1023fc064]
144 ??? (UIKitCore + 4724148) [0x1954c95b4]
144 ??? (UIKitCore + 4009648) [0x19541aeb0]
144 ??? (GraphicsServices + 4548) [0x1de8941c4]
144 ??? (CoreFoundation + 337968) [0x1928b4830]
140 ??? (CoreFoundation + 341056) [0x1928b5440]
140 ??? (CoreFoundation + 352772) [0x1928b8204]
140 ??? (libdispatch.dylib + 75260) [0x19a5c85fc]
140 ??? (libdispatch.dylib + 76020) [0x19a5c88f4]
140 ??? (libdispatch.dylib + 106756) [0x19a5d0104]
140 ??? (libdispatch.dylib + 111932) [0x19a5d153c]
140 ??? (libdispatch.dylib + 30080) [0x19a5bd580]
140 ??? (libdispatch.dylib + 16592) [0x19a5ba0d0]
140 ??? (Ai-POSX + 6360552) [0x102a04de8]
78 ??? (Ai-POSX + 1107704) [0x1025026f8]
78 ??? (Ai-POSX + 7069084) [0x102ab1d9c]
78 ??? (Ai-POSX + 6520772) [0x102a2bfc4]
78 ??? (Ai-POSX + 6522956) [0x102a2c84c]
76 ??? (UIKitCore + 695192) [0x1950f1b98]
76 ??? (CoreGraphics + 253448) [0x1948dee08]
74 ??? (CoreGraphics + 255132) [0x1948df49c]
74 ??? (CoreGraphics + 198936) [0x1948d1918]
74 ??? (CoreGraphics + 371692) [0x1948fbbec]
74 ??? (CoreGraphics + 382716) [0x1948fe6fc]
55 ??? (libsystem_platform.dylib + 8396) [0x21ab250cc]


Powerstats for: Ai-POSX [3566]
UUID: 3C64164C-5334-35B7-92EB-1BF3D1BF4AC6
Path: /private/var/containers/Bundle/Application/C5A077D2-4843-45BA-8434-15CF5047F002/Ai-POSX.app/Ai-POSX
Identifier: b4i.AiPOSX
Version: 4.22 (4.22)
Adam ID: 6469747360
Is First Party: No
Beta Identifier: B6678C13-709E-4D2A-9AAE-3CBF70C91FE4
Resource Coalition: 157 samples "b4i.AiPOSX"(2052)
Architecture: arm64
Parent: UNKNOWN [1]
UID: 501
Footprint: 207.75 MB
Start time: 2024-12-12 10:17:05.438 +1000
End time: 2024-12-12 10:20:03.791 +1000
Num samples: 157 (100%)
Num threads: 8
Primary state: 90 samples Frontmost App, Non-Suppressed, User mode, Effective Thread QoS User Interactive, Requested Thread QoS User Interactive, Override Thread QoS Unspecified, p-core
User Activity: 0 samples Idle, 157 samples Active
Power Source: 157 samples on Battery, 0 samples on AC
144 ??? (dyld + 212680) [0x1b82a2ec8]
144 ??? (Ai-POSX + 32868) [0x1023fc064]
144 ??? (UIKitCore + 4724148) [0x1954c95b4]
144 ??? (UIKitCore + 4009648) [0x19541aeb0]
144 ??? (GraphicsServices + 4548) [0x1de8941c4]
144 ??? (CoreFoundation + 337968) [0x1928b4830]
140 ??? (CoreFoundation + 341056) [0x1928b5440]
140 ??? (CoreFoundation + 352772) [0x1928b8204]
140 ??? (libdispatch.dylib + 75260) [0x19a5c85fc]
140 ??? (libdispatch.dylib + 76020) [0x19a5c88f4]
140 ??? (libdispatch.dylib + 106756) [0x19a5d0104]
140 ??? (libdispatch.dylib + 111932) [0x19a5d153c]
140 ??? (libdispatch.dylib + 30080) [0x19a5bd580]
140 ??? (libdispatch.dylib + 16592) [0x19a5ba0d0]
140 ??? (Ai-POSX + 6360552) [0x102a04de8]
78 ??? (Ai-POSX + 1107704) [0x1025026f8]
78 ??? (Ai-POSX + 7069084) [0x102ab1d9c]
78 ??? (Ai-POSX + 6520772) [0x102a2bfc4]
78 ??? (Ai-POSX + 6522956) [0x102a2c84c]
76 ??? (UIKitCore + 695192) [0x1950f1b98]
76 ??? (CoreGraphics + 253448) [0x1948dee08]
74 ??? (CoreGraphics + 255132) [0x1948df49c]
74 ??? (CoreGraphics + 198936) [0x1948d1918]
74 ??? (CoreGraphics + 371692) [0x1948fbbec]
74 ??? (CoreGraphics + 382716) [0x1948fe6fc]
55 ??? (libsystem_platform.dylib + 8396) [0x21ab250cc]
35 <Kernel mode>
10 ??? (libsystem_platform.dylib + 8364) [0x21ab250ac]
10 <Kernel mode>
6 ??? (libsystem_platform.dylib + 8420) [0x21ab250e4]
4 <Kernel mode>
2 ??? (libsystem_platform.dylib + 8416) [0x21ab250e0]
1 ??? (libsystem_platform.dylib + 8184) [0x21ab24ff8]
2 ??? (CoreGraphics + 255000) [0x1948df418]
1 ??? (CoreGraphics + 255388) [0x1948df59c]
1 ??? (CoreGraphics + 80448) [0x1948b4a40]
1 ??? (CoreGraphics + 80692) [0x1948b4b34]
......more

Binary Images:
0x1023f4000 - 0x102dcffff b4i.AiPOSX 4.22 (4.22) <3C64164C-5334-35B7-92EB-1BF3D1BF4AC6> /private/var/containers/Bundle/Application/C5A077D2-4843-45BA-8434-15CF5047F002/Ai-POSX.app/Ai-POSX
0x18fba0000 - 0x18fbf0d5f libobjc.A.dylib <1608892E-67DB-3F94-9FC2-91492B86C95F> /usr/lib/libobjc.A.dylib
0x1914a5000 - 0x1921b2fff Foundation <6D0212CC-3B9E-32C9-BE20-72989CE3ACB8> /System/Library/Frameworks/Foundation.framework/Foundation
0x192862000 - 0x192da4fff CoreFoundation <1532D3D8-9B3B-3F2F-B35F-55A20DDF411B> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x194313000 - 0x1946b8fff QuartzCore <D8E8E86D-85AC-3C90-B2E1-940235ECAA18> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x1948a1000 - 0x194f92fff CoreGraphics <519DCABF-190B-3A02-B4A1-F90A0D16FE4C> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x195048000 - 0x196f1bfff UIKitCore <575E5140-FA6A-37C2-B00B-A4EACEDFDA53> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x19a5b6000 - 0x19a5fbfff libdispatch.dylib <7DE7EC03-CFB7-349D-9B9E-8782B38F231D> /usr/lib/system/libdispatch.dylib
0x1a2b0b000 - 0x1a2b46ff7 libsystem_malloc.dylib <5DBA2C01-92CA-3D1D-A27E-B4E14CFFB2F0> /usr/lib/system/libsystem_malloc.dylib
0x1b826f000 - 0x1b82f299f dyld <3060D36A-16CE-3C3A-9258-3881459F5714> /usr/lib/dyld
0x1de893000 - 0x1de89bfff GraphicsServices <8425EA11-000E-3E5E-8ABC-BDDF3FF3FA32> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x1e2c75000 - 0x1e2caeff3 libsystem_kernel.dylib <B9618C71-C0CB-31B6-825F-92A4737C890E> /usr/lib/system/libsystem_kernel.dylib
0x21ab23000 - 0x21ab2afe3 libsystem_platform.dylib <5079E5E0-3525-3D53-8FF0-3E297A22FC4F> /usr/lib/system/libsystem_platform.dylib
0x21ace7000 - 0x21acf3ff3 libsystem_pthread.dylib <3CA98E38-8EEE-3C26-9862-C5F66AAD93C0> /usr/lib/system/libsystem_pthread.dylib
0x2214aa000 - 0x2215eefff RenderBox <0837ABA1-A8E8-314F-A37A-46796D9AD06B> /System/Library/PrivateFrameworks/RenderBox.framework/RenderBox
[/CODE]

However, I was un-successful in symbolicating the crash log. So I built-in the KSCrash reporting and got the below 2 crash logs.

[CODE lang="b4x" title="KSCrash Log 1"]Incident Identifier: BCBFBE07-21C1-4B2E-9A10-102D312FB791
CrashReporter Key: 7505507639971381a237a594d721bdc0a44d89cb
Hardware Model: iPad13,16
Process: Ai-POSX [2798]
Path: /private/var/containers/Bundle/Application/77294858-92E8-449E-9E9E-B6D0C0BB02DA/Ai-POSX.app/Ai-POSX
Identifier: b4i.AiPOSX
Version: 4.39 (4.39)
Code Type: ARM-64
Parent Process: ? [1]

Date/Time: 2025-01-14 09:30:06.000 +1000
OS Version: iPadOS 18.2.1 (22C161)
Report Version: 104

Exception Type: 0 (SIGPIPE)
Exception Codes: 0x00000000 at 0x000000022c9a6fcc
Crashed Thread: 0

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_platform.dylib 0x000000022c9a6fcc 0x22c9a4000 + 12236 (_platform_memset + 140)
1 CoreGraphics 0x00000001a4008c4c 0x1a3f9e000 + 437324 (CGBlt_fillBytes + 276)
2 CoreGraphics 0x00000001a3fab7e0 0x1a3f9e000 + 55264 (<redacted> + 9852)
3 CoreGraphics 0x00000001a4008514 0x1a3f9e000 + 435476 (<redacted> + 1108)
4 CoreGraphics 0x00000001a3fd1330 0x1a3f9e000 + 209712 (<redacted> + 504)
5 CoreGraphics 0x00000001a3fcf0d0 0x1a3f9e000 + 200912 (<redacted> + 472)
6 CoreGraphics 0x00000001a3ff2944 0x1a3f9e000 + 346436 (CGContextDrawPath + 336)
7 UIKitCore 0x00000001a4823480 0x1a474c000 + 881792 (<redacted> + 160)
8 Ai-POSX 0x00000001047d6350 0x1040d0000 + 7365456 (-[B4ICanvas DrawPath::::] + 252)
9 Ai-POSX 0x00000001047d5ac8 0x1040d0000 + 7363272 (-[B4ICanvas DrawRect::::] + 216)
10 Ai-POSX 0x000000010485b8a0 0x1040d0000 + 7911584 ( + 60)
11 Ai-POSX 0x0000000104208e44 0x1040d0000 + 1281604 ( + 828)
12 Ai-POSX 0x00000001047ae8ec 0x1040d0000 + 7203052 (__21-[B4ICommon Sleep:::]_block_invoke + 48)
13 libdispatch.dylib 0x00000001a9cdffa8 0x1a9cdc000 + 16296 (<redacted> + 20)
14 libdispatch.dylib 0x00000001a9ce345c 0x1a9cdc000 + 29788 (<redacted> + 596)
15 libdispatch.dylib 0x00000001a9cf7620 0x1a9cdc000 + 112160 (<redacted> + 420)
16 libdispatch.dylib 0x00000001a9cf61e8 0x1a9cdc000 + 106984 (<redacted> + 836)
17 libdispatch.dylib 0x00000001a9cee948 0x1a9cdc000 + 76104 (<redacted> + 748)
18 libdispatch.dylib 0x00000001a9cee64c 0x1a9cdc000 + 75340 (_dispatch_main_queue_callback_4CF + 44)
19 CoreFoundation 0x00000001a1fa9bbc 0x1a1f30000 + 498620 (<redacted> + 16)
20 CoreFoundation 0x00000001a1fa61b0 0x1a1f30000 + 483760 (<redacted> + 1996)
21 CoreFoundation 0x00000001a1ff8274 0x1a1f30000 + 819828 (CFRunLoopRunSpecific + 588)
22 GraphicsServices 0x00000001ef1414c0 0x1ef140000 + 5312 (GSEventRunModal + 164)
23 UIKitCore 0x00000001a4b3a77c 0x1a474c000 + 4122492 (<redacted> + 816)
24 UIKitCore 0x00000001a4760e64 0x1a474c000 + 85604 (UIApplicationMain + 340)
25 Ai-POSX 0x00000001040d4064 0x1040d0000 + 16484 ( + 100)
26 (null) 0x00000001c81b4de8 0x0 + 7652199912

Thread 1 name: com.apple.uikit.eventfetch-thread
Thread 1:
0 libsystem_kernel.dylib 0x00000001f355a788 0x1f3559000 + 6024 (mach_msg2_trap + 8)
1 libsystem_kernel.dylib 0x00000001f355de98 0x1f3559000 + 20120 (mach_msg2_internal + 80)
2 libsystem_kernel.dylib 0x00000001f355ddb0 0x1f3559000 + 19888 (mach_msg_overwrite + 424)
3 libsystem_kernel.dylib 0x00000001f355dbfc 0x1f3559000 + 19452 (mach_msg + 24)
4 CoreFoundation 0x00000001a1fa67f4 0x1a1f30000 + 485364 (<redacted> + 160)
5 CoreFoundation 0x00000001a1fa5ea0 0x1a1f30000 + 482976 (<redacted> + 1212)
6 CoreFoundation 0x00000001a1ff8274 0x1a1f30000 + 819828 (CFRunLoopRunSpecific + 588)
7 Foundation 0x00000001a0b5eb48 0x1a0b35000 + 170824 (<redacted> + 212)
8 Foundation 0x00000001a0cbb6f4 0x1a0b35000 + 1599220 (<redacted> + 64)
9 UIKitCore 0x00000001a4bcdb80 0x1a474c000 + 4725632 (<redacted> + 420)
10 Foundation 0x00000001a0c4aa54 0x1a0b35000 + 1137236 (<redacted> + 724)
11 libsystem_pthread.dylib 0x000000022ca517d0 0x22ca50000 + 6096 (_pthread_start + 136)

Thread 2:
0 libsystem_kernel.dylib 0x00000001f35602b0 0x1f3559000 + 29360 (__semwait_signal + 8)
1 libsystem_c.dylib 0x00000001a9d3a5cc 0x1a9d22000 + 99788 (nanosleep + 220)
2 Foundation 0x00000001a13e1238 0x1a0b35000 + 9093688 (<redacted> + 160)
3 Ai-POSX 0x00000001048191f0 0x1040d0000 + 7639536 (-[B4IUDPSocket readerThread] + 668)
4 Foundation 0x00000001a0c4aa54 0x1a0b35000 + 1137236 (<redacted> + 724)
5 libsystem_pthread.dylib 0x000000022ca517d0 0x22ca50000 + 6096 (_pthread_start + 136)

Thread 3:
0 libsystem_kernel.dylib 0x00000001f35602b0 0x1f3559000 + 29360 (__semwait_signal + 8)
1 libsystem_c.dylib 0x00000001a9d3a5cc 0x1a9d22000 + 99788 (nanosleep + 220)
2 libsystem_c.dylib 0x00000001a9d3a444 0x1a9d22000 + 99396 (sleep + 52)
3 Ai-POSX 0x00000001048c1f94 0x1040d0000 + 8331156 ( + 132)
4 libsystem_pthread.dylib 0x000000022ca517d0 0x22ca50000 + 6096 (_pthread_start + 136)

Thread 4 name: KSCrash Exception Handler (Secondary)
Thread 4:
0 libsystem_kernel.dylib 0x00000001f355a788 0x1f3559000 + 6024 (mach_msg2_trap + 8)
1 libsystem_kernel.dylib 0x00000001f355de98 0x1f3559000 + 20120 (mach_msg2_internal + 80)
2 libsystem_kernel.dylib 0x00000001f355bcfc 0x1f3559000 + 11516 (thread_suspend + 108)
3 Ai-POSX 0x00000001048be808 0x1040d0000 + 8316936 ( + 152)
4 libsystem_pthread.dylib 0x000000022ca517d0 0x22ca50000 + 6096 (_pthread_start + 136)

Thread 5 name: KSCrash Exception Handler (Primary)
Thread 5:
0 libsystem_kernel.dylib 0x00000001f355a788 0x1f3559000 + 6024 (mach_msg2_trap + 8)
1 libsystem_kernel.dylib 0x00000001f355de98 0x1f3559000 + 20120 (mach_msg2_internal + 80)
2 libsystem_kernel.dylib 0x00000001f355ddb0 0x1f3559000 + 19888 (mach_msg_overwrite + 424)
3 libsystem_kernel.dylib 0x00000001f355dbfc 0x1f3559000 + 19452 (mach_msg + 24)
4 Ai-POSX 0x00000001048be840 0x1040d0000 + 8316992 ( + 208)
5 libsystem_pthread.dylib 0x000000022ca517d0 0x22ca50000 + 6096 (_pthread_start + 136)

Thread 6:
0 libsystem_kernel.dylib 0x00000001f355a510 0x1f3559000 + 5392 (__workq_kernreturn + 8)
1 libsystem_pthread.dylib 0x000000022ca536cc 0x22ca50000 + 14028 (_pthread_wqthread + 364)

Thread 7:
0 libsystem_kernel.dylib 0x00000001f355a510 0x1f3559000 + 5392 (__workq_kernreturn + 8)
1 libsystem_pthread.dylib 0x000000022ca536cc 0x22ca50000 + 14028 (_pthread_wqthread + 364)

Thread 8:
0 libsystem_pthread.dylib 0x000000022ca5146c 0x22ca50000 + 5228 (pthread_getspecific + 12)

Thread 9:

Thread 0 crashed with ARM-64 Thread State:
cpsr: 0x0000000020001000 fp: 0x000000016bd2df10 lr: 0x00000001a4008c4c pc: 0x000000022c9a6fcc
sp: 0x000000016bd2dee0 x0: 0x00000001235c3e00 x1: 0x0000000000000000 x10: 0x0000000000000000
x11: 0x0000000000000000 x12: 0x00000000000000e8 x13: 0x0000000000000001 x14: 0x0000000000000004
x15: 0x000000000000e200 x16: 0x000000022c9a6ee0 x17: 0x00000001a3fab6bc x18: 0x0000000000000000
x19: 0x00000001235c3e00 x2: 0x0000000000000148 x20: 0x0000000000000388 x21: 0x0000000000000067
x22: 0x00000000000003a0 x23: 0x00000001235a8020 x24: 0x0000000000000000 x25: 0x00000000ffffff00
x26: 0x00000001253fc720 x27: 0x00000000000000e2 x28: 0x00000001235a8020 x29: 0x000000016bd2df10
x3: 0x00000001235c4000 x4: 0x00000001235c3e80 x5: 0x0000000000000001 x6: 0x0000000301b53788
x7: 0x0000000301b53788 x8: 0x0000000000000001 x9: 0x0000000000000001

Binary Images:
0x1040d0000 - 0x1049dbfff +Ai-POSX arm64 <cb8faa9fb4de3c6a958cdfc7674935ad> /private/var/containers/Bundle/Application/77294858-92E8-449E-9E9E-B6D0C0BB02DA/Ai-POSX.app/Ai-POSX
0x105fa8000 - 0x105fb3fff libobjc-trampolines.dylib arm64 <be05652226b13a508ad193ac99fcdc9c> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
0x19f4a8000 - 0x19f4f8ccf libobjc.A.dylib arm64 <3ed8b852087d3b6ea36fceafed8e93ae> /usr/lib/libobjc.A.dylib
0x19f4f9000 - 0x1a051cfff MetalPerformanceShadersGraph arm64 <c63300c9521d31c5bce2c53f1daa6650> /System/Library/Frameworks/MetalPerformanceShadersGraph.framework/MetalPerformanceShadersGraph
0x1a051d000 - 0x1a0abefff libswiftCore.dylib arm64 <e9b1dc6b7fef3bbbb083f4e8faaa53df> /usr/lib/swift/libswiftCore.dylib
0x1a0abf000 - 0x1a0b00b34 libswiftPrespecialized.dylib arm64 <a60c51d4e0e8363e90a4110a0d93f1f2> /usr/lib/libswiftPrespecialized.dylib
0x1a0b01000 - 0x1a0b34ffb CoreServicesInternal arm64 <6c069b24efe63a9facb6609247014c22> /System/Library/PrivateFrameworks/CoreServicesInternal.framework/CoreServicesInternal
0x1a0b35000 - 0x1a1865fff Foundation arm64 <7274dde368d634a08e677726e1265e80> /System/Library/Frameworks/Foundation.framework/Foundation
0x1a1866000 - 0x1a1a95fff WebGPU arm64 <836f7c6c57bd3ce9a7e2d67bec54e689> /System/Library/PrivateFrameworks/WebGPU.framework/WebGPU
0x1a1a96000 - 0x1a1cf8fff Metal arm64 <c699f21c7c513168b5f734c029e55401> /System/Library/Frameworks/Metal.framework/Metal
0x1a1cf9000 - 0x1a1f2ffff CoreServices arm64 <472e685d98ff3176a744411100947046> /System/Library/Frameworks/CoreServices.framework/CoreServices
0x1a1f30000 - 0x1a2473fff CoreFoundation arm64 <6a60be13e6573beca9acba239ae29862> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
.........more

Extra Information:

Stack Dump (0x000000016bd2de90-0x000000016bd2df80):

E2000000E2000000B8007895C5A356D8080008000000000020724F0A020000000000000000000000C0B53A230100000080B43A2301000000B8007895C5A356D8080008000000000020724F0A0200000020724F0A02000000C0B53A23000000000000000000000000000000FF000000000600000000000000000000000000000020E0D26B01000000E0B7FAA301000000000000000000000000200E000000000090C73F2501000000C0394F0A02000000080008000000000020724F0A020000000000000000000000020000000000000020410A0103000000000000000000000000200E00000000000070530601000000

Notable Addresses:
{}

Application Stats:
{
"active_time_since_last_crash": 2334.18,
"active_time_since_launch": 2334.18,
"application_active": true,
"application_in_foreground": true,
"background_time_since_last_crash": 767.486,
"background_time_since_launch": 767.486,
"launches_since_last_crash": 1,
"sessions_since_last_crash": 4,
"sessions_since_launch": 4
}
[/CODE]

[CODE lang="b4x" title="KSCrash Log 2"]Incident Identifier: 5F6FD41E-FF7A-4953-AAD3-0A51EBA92624
CrashReporter Key: 7505507639971381a237a594d721bdc0a44d89cb
Hardware Model: iPad13,16
Process: Ai-POSX [2824]
Path: /private/var/containers/Bundle/Application/77294858-92E8-449E-9E9E-B6D0C0BB02DA/Ai-POSX.app/Ai-POSX
Identifier: b4i.AiPOSX
Version: 4.39 (4.39)
Code Type: ARM-64
Parent Process: ? [1]

Date/Time: 2025-01-14 09:40:43.000 +1000
OS Version: iPadOS 18.2.1 (22C161)
Report Version: 104

Exception Type: 0 (SIGPIPE)
Exception Codes: 0x00000000 at 0x00000001a1f3d650
Crashed Thread: 0

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 CoreFoundation 0x00000001a1f3d650 0x1a1f30000 + 54864 (__CFStringHash + 120)
1 CoreFoundation 0x00000001a1f3d3d0 0x1a1f30000 + 54224 (<redacted> + 108)
2 UIKitCore 0x00000001a4774390 0x1a474c000 + 164752 (<redacted> + 56)
3 UIKitCore 0x00000001a47740e0 0x1a474c000 + 164064 (<redacted> + 132)
4 UIKitCore 0x00000001a4774218 0x1a474c000 + 164376 (<redacted> + 288)
5 QuartzCore 0x00000001a3a20cdc 0x1a3a08000 + 101596 (<redacted> + 148)
6 QuartzCore 0x00000001a3a20b50 0x1a3a08000 + 101200 (<redacted> + 204)
7 QuartzCore 0x00000001a3a9a36c 0x1a3a08000 + 598892 (<redacted> + 128)
8 Ai-POSX 0x00000001049aeea0 0x1042a8000 + 7368352 (-[B4ICanvas Refresh] + 120)
9 Ai-POSX 0x00000001043e0f38 0x1042a8000 + 1281848 ( + 1072)
10 Ai-POSX 0x00000001049868ec 0x1042a8000 + 7203052 (__21-[B4ICommon Sleep:::]_block_invoke + 48)
11 libdispatch.dylib 0x00000001a9cdffa8 0x1a9cdc000 + 16296 (<redacted> + 20)
12 libdispatch.dylib 0x00000001a9ce345c 0x1a9cdc000 + 29788 (<redacted> + 596)
13 libdispatch.dylib 0x00000001a9cf7620 0x1a9cdc000 + 112160 (<redacted> + 420)
14 libdispatch.dylib 0x00000001a9cf61e8 0x1a9cdc000 + 106984 (<redacted> + 836)
15 libdispatch.dylib 0x00000001a9cee948 0x1a9cdc000 + 76104 (<redacted> + 748)
16 libdispatch.dylib 0x00000001a9cee64c 0x1a9cdc000 + 75340 (_dispatch_main_queue_callback_4CF + 44)
17 CoreFoundation 0x00000001a1fa9bbc 0x1a1f30000 + 498620 (<redacted> + 16)
18 CoreFoundation 0x00000001a1fa61b0 0x1a1f30000 + 483760 (<redacted> + 1996)
19 CoreFoundation 0x00000001a1ff8274 0x1a1f30000 + 819828 (CFRunLoopRunSpecific + 588)
20 GraphicsServices 0x00000001ef1414c0 0x1ef140000 + 5312 (GSEventRunModal + 164)
21 UIKitCore 0x00000001a4b3a77c 0x1a474c000 + 4122492 (<redacted> + 816)
22 UIKitCore 0x00000001a4760e64 0x1a474c000 + 85604 (UIApplicationMain + 340)
23 Ai-POSX 0x00000001042ac064 0x1042a8000 + 16484 ( + 100)
24 (null) 0x00000001c81b4de8 0x0 + 7652199912

Thread 1 name: com.apple.uikit.eventfetch-thread
Thread 1:
0 libsystem_kernel.dylib 0x00000001f355a788 0x1f3559000 + 6024 (mach_msg2_trap + 8)
1 libsystem_kernel.dylib 0x00000001f355de98 0x1f3559000 + 20120 (mach_msg2_internal + 80)
2 libsystem_kernel.dylib 0x00000001f355ddb0 0x1f3559000 + 19888 (mach_msg_overwrite + 424)
3 libsystem_kernel.dylib 0x00000001f355dbfc 0x1f3559000 + 19452 (mach_msg + 24)
4 CoreFoundation 0x00000001a1fa67f4 0x1a1f30000 + 485364 (<redacted> + 160)
5 CoreFoundation 0x00000001a1fa5ea0 0x1a1f30000 + 482976 (<redacted> + 1212)
6 CoreFoundation 0x00000001a1ff8274 0x1a1f30000 + 819828 (CFRunLoopRunSpecific + 588)
7 Foundation 0x00000001a0b5eb48 0x1a0b35000 + 170824 (<redacted> + 212)
8 Foundation 0x00000001a0cbb6f4 0x1a0b35000 + 1599220 (<redacted> + 64)
9 UIKitCore 0x00000001a4bcdb80 0x1a474c000 + 4725632 (<redacted> + 420)
10 Foundation 0x00000001a0c4aa54 0x1a0b35000 + 1137236 (<redacted> + 724)
11 libsystem_pthread.dylib 0x000000022ca517d0 0x22ca50000 + 6096 (_pthread_start + 136)

Thread 2:
0 libsystem_kernel.dylib 0x00000001f35602b0 0x1f3559000 + 29360 (__semwait_signal + 8)
1 libsystem_c.dylib 0x00000001a9d3a5cc 0x1a9d22000 + 99788 (nanosleep + 220)
2 Foundation 0x00000001a13e1238 0x1a0b35000 + 9093688 (<redacted> + 160)
3 Ai-POSX 0x00000001049f11f0 0x1042a8000 + 7639536 (-[B4IUDPSocket readerThread] + 668)
4 Foundation 0x00000001a0c4aa54 0x1a0b35000 + 1137236 (<redacted> + 724)
5 libsystem_pthread.dylib 0x000000022ca517d0 0x22ca50000 + 6096 (_pthread_start + 136)

Thread 3:
0 libsystem_kernel.dylib 0x00000001f35602b0 0x1f3559000 + 29360 (__semwait_signal + 8)
1 libsystem_c.dylib 0x00000001a9d3a5cc 0x1a9d22000 + 99788 (nanosleep + 220)
2 libsystem_c.dylib 0x00000001a9d3a444 0x1a9d22000 + 99396 (sleep + 52)
3 Ai-POSX 0x0000000104a99f94 0x1042a8000 + 8331156 ( + 132)
4 libsystem_pthread.dylib 0x000000022ca517d0 0x22ca50000 + 6096 (_pthread_start + 136)

Thread 4 name: KSCrash Exception Handler (Secondary)
Thread 4:
0 libsystem_kernel.dylib 0x00000001f355a788 0x1f3559000 + 6024 (mach_msg2_trap + 8)
1 libsystem_kernel.dylib 0x00000001f355de98 0x1f3559000 + 20120 (mach_msg2_internal + 80)
2 libsystem_kernel.dylib 0x00000001f355bcfc 0x1f3559000 + 11516 (thread_suspend + 108)
3 Ai-POSX 0x0000000104a96808 0x1042a8000 + 8316936 ( + 152)
4 libsystem_pthread.dylib 0x000000022ca517d0 0x22ca50000 + 6096 (_pthread_start + 136)

Thread 5 name: KSCrash Exception Handler (Primary)
Thread 5:
0 libsystem_kernel.dylib 0x00000001f355a788 0x1f3559000 + 6024 (mach_msg2_trap + 8)
1 libsystem_kernel.dylib 0x00000001f355de98 0x1f3559000 + 20120 (mach_msg2_internal + 80)
2 libsystem_kernel.dylib 0x00000001f355ddb0 0x1f3559000 + 19888 (mach_msg_overwrite + 424)
3 libsystem_kernel.dylib 0x00000001f355dbfc 0x1f3559000 + 19452 (mach_msg + 24)
4 Ai-POSX 0x0000000104a96840 0x1042a8000 + 8316992 ( + 208)
5 libsystem_pthread.dylib 0x000000022ca517d0 0x22ca50000 + 6096 (_pthread_start + 136)

Thread 6:
0 libsystem_pthread.dylib 0x000000022ca5146c 0x22ca50000 + 5228 (pthread_getspecific + 12)

Thread 7:
0 libsystem_kernel.dylib 0x00000001f355a510 0x1f3559000 + 5392 (__workq_kernreturn + 8)
1 libsystem_pthread.dylib 0x000000022ca536cc 0x22ca50000 + 14028 (_pthread_wqthread + 364)

Thread 8:
0 libsystem_kernel.dylib 0x00000001f355a510 0x1f3559000 + 5392 (__workq_kernreturn + 8)
1 libsystem_pthread.dylib 0x000000022ca536cc 0x22ca50000 + 14028 (_pthread_wqthread + 364)

Thread 9:

Thread 0 crashed with ARM-64 Thread State:
cpsr: 0x0000000000001000 fp: 0x000000016bb56300 lr: 0x00000001a1f3d3d0 pc: 0x00000001a1f3d650
sp: 0x000000016bb562c0 x0: 0x000000020c35d460 x1: 0x00000002165128d8 x10: 0x00000001a3d5a58f
x11: 0x00000000000007c8 x12: 0x0000000000000005 x13: 0x00000001094c5880 x14: 0x000000020a5014d0
x15: 0x000000020a5014d0 x16: 0x000000020a5024c0 x17: 0x00000001a1f3e100 x18: 0x0000000000000000
x19: 0x000000020c35d460 x2: 0x000000020c35d460 x20: 0x0000000303d04b50 x21: 0x0000000000000047
x22: 0x0000000303cfa280 x23: 0x00000001133ed040 x24: 0x0000000106948780 x25: 0x000000020a4f7220
x26: 0x0000000000080008 x27: 0x000000020a4f39c0 x28: 0x000000020a4f3a40 x29: 0x000000016bb56300
x3: 0x000000020c35d460 x4: 0x0000000000000000 x5: 0x0000000000000000 x6: 0x00000000000007fd
x7: 0x0000000000f9092c x8: 0x0000000000000008 x9: 0x000000020c35d468

Binary Images:
0x1042a8000 - 0x104bb3fff +Ai-POSX arm64 <cb8faa9fb4de3c6a958cdfc7674935ad> /private/var/containers/Bundle/Application/77294858-92E8-449E-9E9E-B6D0C0BB02DA/Ai-POSX.app/Ai-POSX
0x105890000 - 0x10589bfff libobjc-trampolines.dylib arm64 <be05652226b13a508ad193ac99fcdc9c> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
0x19f4a8000 - 0x19f4f8ccf libobjc.A.dylib arm64 <3ed8b852087d3b6ea36fceafed8e93ae> /usr/lib/libobjc.A.dylib
0x19f4f9000 - 0x1a051cfff MetalPerformanceShadersGraph arm64 <c63300c9521d31c5bce2c53f1daa6650> /System/Library/Frameworks/MetalPerformanceShadersGraph.framework/MetalPerformanceShadersGraph
0x1a051d000 - 0x1a0abefff libswiftCore.dylib arm64 <e9b1dc6b7fef3bbbb083f4e8faaa53df> /usr/lib/swift/libswiftCore.dylib
0x1a0abf000 - 0x1a0b00b34 libswiftPrespecialized.dylib arm64 <a60c51d4e0e8363e90a4110a0d93f1f2> /usr/lib/libswiftPrespecialized.dylib
0x1a0b01000 - 0x1a0b34ffb CoreServicesInternal arm64 <6c069b24efe63a9facb6609247014c22> /System/Library/PrivateFrameworks/CoreServicesInternal.framework/CoreServicesInternal
0x1a0b35000 - 0x1a1865fff Foundation arm64 <7274dde368d634a08e677726e1265e80> /System/Library/Frameworks/Foundation.framework/Foundation
0x1a1866000 - 0x1a1a95fff WebGPU arm64 <836f7c6c57bd3ce9a7e2d67bec54e689> /System/Library/PrivateFrameworks/WebGPU.framework/WebGPU
0x1a1a96000 - 0x1a1cf8fff Metal arm64 <c699f21c7c513168b5f734c029e55401> /System/Library/Frameworks/Metal.framework/Metal
0x1a1cf9000 - 0x1a1f2ffff CoreServices arm64 <472e685d98ff3176a744411100947046> /System/Library/Frameworks/CoreServices.framework/CoreServices
0x1a1f30000 - 0x1a2473fff CoreFoundation arm64 <6a60be13e6573beca9acba239ae29862> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x1a2474000 - 0x1a3424fff Network arm64 <5389a7437c0f3a37b35c6825a8263f94> /System/Library/Frameworks/Network.framework/Network
0x1a3425000 - 0x1a37e9fff CFNetwork arm64 <9987879240643260b5b2779a99b9f64e> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x1a37ea000 - 0x1a3a07fff CoreTelephony arm64 <4fce9fdac4c9349687b92f426e9ed142> /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony
...........more

Extra Information:

Stack Dump (0x000000016bb56270-0x000000016bb56360):

D063B56B01000000DC42F3A101000000403A4F0A02000000C0394F0A020000004F00000000000000C030421B010000000064B56B010000004843F3A10100000001000000000000000100000000000000080008000000000020724F0A02000000000000000000000040D03E130100000080A2CF0303000000C08F461B01000000FFFFFFFFFFFFFFFF60D4350C020000002063B56B01000000904377A401000000C08F461B0100000060D4350C020000004063B56B01000000E04077A40100000060D4350C0200000080A2CF0303000000C063B56B01000000184277A4010000009063B56B010000007CA355F301000000

Notable Addresses:
{
"x1": {
"address": 8964352216,
"type": "string",
"value": "hash"
},
"x10": {
"address": 7043655055,
"type": "string",
"value": "contents"
}
}

Application Stats:
{
"active_time_since_last_crash": 434.15,
"active_time_since_launch": 434.15,
"application_active": true,
"application_in_foreground": true,
"background_time_since_last_crash": 148.285,
"background_time_since_launch": 148.285,
"launches_since_last_crash": 1,
"sessions_since_last_crash": 2,
"sessions_since_launch": 2
}
[/CODE]

From the above 2 logs, gathered that the crash might have something to do with b4xcanvas. So, I went through the entire project looking for a B4xcanvas being initialized inside a loop or not being released after usage, but I found none like that.

One other step that I took hoping to solve the issue was to disable the UDP broadcast as the the exception type was [SIGPIPE], and as I understand happens when trying to access a socket that has been closed. Not sure whether this is the cause of the issue.

Anyway any help or insight on this will be very valuable to me. It is a cross platform app, the issue only persists for the iOS app. Have not been able to recreate the issue. Thanks.
 
Last edited:
It does look related to the canvas. Can you post the code with the call to Sleep and the canvas drawings?
Thanks for your reply. The only modules that use canvas are AnotherDatePicker class module, QRGenerator class module and a function I got that resizes bitmap. And AnotherDatePicker is the only one that calls sleep before proceeding with the drawings.

[CODE lang="b4x" title="AnotherDatePicker (Source : B4X Forum)" highlight="43,68,69,74,85"]Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
mBase = Base
Dim mlbl As B4XView = Lbl
#if B4J
Dim form As Form = Props.Get("Form")
MainPanel = form.RootPane
Dim df As TextField
df.Initialize("DateField")
Dim b As Button
b.Initialize("btnOpen")
Dim fx As JFX
b.Font = fx.CreateFontAwesome(30)
b.WrapText = False
#else if B4A
MainPanel = Props.Get("activity")
Dim df As EditText
df.Initialize("DateField")
df.SingleLine = True
df.Padding = Array As Int(20dip,0,0,0)
Dim b As Button
b.Initialize("btnOpen")
b.Typeface = Typeface.FONTAWESOME
#else if B4i
MainPanel = Props.Get("page")
Dim df As TextField
df.Initialize("DateField")
Dim b As Button
b.Initialize("btnOpen", b.STYLE_SYSTEM)
b.CustomLabel.Font = Font.CreateFontAwesome(30)
#end if
btnOpen = b
dateField = df
dateField.Font = mlbl.Font
dateField.SetColorAndBorder(xui.Color_White, 1dip, xui.Color_Black, 15dip)
dateField.TextColor = mlbl.TextColor
dateField.Enabled = False
mBase.AddView(dateField, 0,0,0,0)
btnOpen.Font = xui.CreateFontAwesome(UiCodeModule.ViewStyles.POSButton.TextSize)
btnOpen.Text = Chr(0xF073)
btnOpen.TextColor = xui.Color_RGB(209,32,39)
mBase.AddView(btnOpen, 0,0,0,0)
'It is not possible to load a layout file directly from DesignerCreateView.
Sleep(0)
selectedColor = xui.PaintOrColorToColor(Props.Get("SelectedColor"))
tempSelectedColor = xui.PaintOrColorToColor(Props.Get("HighlightedColor"))
pnlDialog = xui.CreatePanel("")
MainPanel.AddView(pnlDialog, 0, 0, 520dip,500dip)
pnlDialog.LoadLayout("datepicker")
pnlDialog.Visible = False
pnlDialog.SetColorAndBorder(xui.PaintOrColorToColor(Props.Get("BackgroundColor")), 1dip, selectedColor, 10dip)
pnlDialog.Tag = Me
#if B4i
For Each v As B4XView In pnlDialog.GetAllViewsRecursive
UiCodeModule.SetStyleForView(v)
Next
#End If
#if B4A
Dim p As Panel = pnlDialog
p.Elevation = 4dip
#End If
month = DateTime.GetMonth(DateTime.Now)
year = DateTime.GetYear(DateTime.Now)
minYear = Props.Get("MinYear")
maxYear = Props.Get("MaxYear")
months = DateUtils.GetMonthsNames
If selectedDate - INVALID_DATE = 0 Then selectedDate = DateTime.Now
setDate(selectedDate)
cvs.Initialize(DaysPaneFg)
cvsBackground.Initialize(DaysPaneBg)
boxW = cvs.TargetRect.Width / 7
boxH = cvs.TargetRect.Height / 6
vCorrection = 5dip
If xui.IsB4i Then vCorrection = 9dip
cvsDays.Initialize(DaysTitlesPane)
Dim alldays As List = Regex.Split("\|", "Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday") 'need to escape the splitting character.
firstDay = alldays.IndexOf(Props.Get("FirstDay"))
Dim daysFont As B4XFont = xui.CreateDefaultBoldFont(14)
Dim i As Int
Dim days As List = DateUtils.GetDaysNames
For i = firstDay To firstDay + 7 - 1
Dim d As String = days.Get(i Mod 7)
cvsDays.DrawText(d.SubString2(0, 2), (i - firstDay + 0.5) * boxW, 20dip, daysFont, xui.Color_Gray, "CENTER")
Next
cvsDays.Invalidate
#if B4J
Dim p As Pane = DaysPaneFg
p.MouseCursor = fx.Cursors.HAND
#End If
Base_Resize(mBase.Width, mBase.Height)
End Sub[/CODE]

QR code printing is not available for this customer. So no chance for that part of code was executed. I'll post the code anyway.
[CODE lang="b4x" title="QRCode Generator [Source: B4X Forum]"]Private Sub DrawMatrix
cvs.DrawRect(cvs.TargetRect, xui.Color_White, True, 0)
Dim r As B4XRect
For y = 0 To NumberOfModules - 1
For x = 0 To NumberOfModules - 1
r.Initialize((x + 4) * ModuleSize, (y + 4) * ModuleSize, 0, 0)
r.Width = ModuleSize
r.Height = ModuleSize
Dim clr As Int
If Matrix(x, y) Then
clr = xui.Color_Black
'cvs.DrawCircle(r.CenterX, r.CenterY, r.Width / 2, clr, True, 0)
cvs.DrawRect(r, clr, True, 0)
End If
Next
Next
End Sub[/CODE]

Again, the option to print through the app is not available to this customer. But will post it anyway
[CODE lang="b4x" title="ResizeBitmapForPrinting [Source: modified version of the function got from the Forum]"]Sub ResizeBitmapForPrinting(bmp As B4XBitmap, CropHeight As Int) As B4XBitmap 'ignore
Dim printWidth As Int = 576
If ResDetails.POSPrinter.PrintWidth > Globals.mPrintWidth.w80mm Then
printWidth = 544
End If

Dim scaleFactor As Float = DataModel.MyConfig.BitmapMagFactor
If bmp.Height < 1500 Then
scaleFactor = (printWidth / bmp.Width)
End If

Dim printHeight As Int = bmp.Height * scaleFactor
Dim DrawPanel As B4XView
DrawPanel = Xui.CreatePanel("") 'InitializeMutable(printWidth, printHeight)
DrawPanel.SetLayoutAnimated(0, 0, 0, printWidth, printHeight)

Dim cvs As B4XCanvas
cvs.Initialize(DrawPanel)

Dim DRect As B4XRect
DRect.Initialize(0, 0, printWidth, printHeight)

bmp.Crop(0, 0, bmp.Width, bmp.Height)

cvs.DrawBitmap(bmp, DRect)
cvs.Invalidate

Return cvs.CreateBitmap
End Sub[/CODE]
 
Upvote 0
Alright! After I have turned off the UDP, the crash has not occurred since. That is very interesting. Maybe the app was trying to broadcast through a busy port and it's a snowball effect that led to a high CPU usage eventually being killed by the OS. Anyway thanks for taking time to look into this Erel. Appreciate it!
 
Upvote 0
Back
Top