airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
206 stars 11 forks source link

[AIR 50.2.2.4.5][iOS] Worker::start() cause crash #3154

Open esdebon opened 7 months ago

esdebon commented 7 months ago

Worker doesn't seem to work with iOS ipa-test, ipa-debug, ipa-app-store and ipa-ad-hoc only with fast packaging interpreter the worker is functioning normally.

Tested with AIR 50.2.2.4.4 and AIR 50.2.2.4.5 even with the latest AIR 51.0.0.4 with macOS M2.
There is no such issue with Android.

The log say:

Unsupported enumeration of UIWindowScene windows on non-main thread.

error

Unsupported enumeration of UIWindowScene windows on non-main thread.

+[UIView setAnimationsEnabled:] being called from a background thread. Performing any operation from a background thread on UIView or a subclass is not supported and may result in unexpected and insidious behavior. trace=( 0 UIKitCore 0x00000001a22975f4 EEA1886F-3227-31C9-B7D8-202AF6530CFF + 18126324 1 libdispatch.dylib 0x00000001a66f4cc0 8A21415C-51AF-3AFC-8BA7-7EC2D9F7EEF1 + 404672 2 libdispatch.dylib 0x00000001a6697810 8A21415C-51AF-3AFC-8BA7-7EC2D9F7EEF1 + 22544 3 UIKitCore 0x00000001a118c648 EEA1886F-3227-31C9-B7D8-202AF6530CFF + 255560 4 UIKitCore 0x00000001a159e330 EEA1886F-3227-31C9-B7D8-202AF6530CFF + 4522800

*** Assertion failure in -[CTApplication _performAfterCATransactionCommitsWithLegacyRunloopObserverBasedTiming:block:], UIApplication.m:3225

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Call must be made on main thread' First throw call stack: (0x19f0c10a8 0x1972a6ca4 0x19e582640 0x1a1277704 0x1a1321720 0x1a11cf618 0x1a11ce5e0 0x1a12abd10 0x1a12abbc0 0x1a1484e48 0x1a1a5b2dc 0x1a1a5b28c 0x1a1a5b23c 0x1a1484db8 0x1a1484c58 0x1a1a5b1ec 0x1a159cb2c 0x1a159c764 0x1a159bd80 0x1a159e374 0x100e432f0 0x100ecc280 0x100ecc8a0 0x100ed3330 0x100ed378c 0x100ed3b0c 0x100ed9864 0x100eda264 0x101214894 0x101214e18 0x101353838 0x1012118b4 0x1f3e457a4 0x1f3e45134)

My code:

[Embed(source="./BackWorker.swf", mimeType="application/octet-stream")]
private static var BackgroundWorker:Class;
.
.
.
WorkerManager.worker = WorkerDomain.current.createWorker(( new BackgroundWorker() as ByteArray));
WorkerManager.worker.addEventListener(flash.events.Event.WORKER_STATE, statusWorker);
WorkerManager.bm = worker.createMessageChannel(Worker.current);
WorkerManager.mb = Worker.current.createMessageChannel(worker);
WorkerManager.worker.setSharedProperty("btm", WorkerManager.bm);
WorkerManager.worker.setSharedProperty("mtb", WorkerManager.mb);
WorkerManager.bm.addEventListener(flash.events.Event.CHANNEL_MESSAGE, onBackToMain);
WorkerManager.worker.start(); // Here Crash

To test I created an empty "BackWorker.swf" file and I got the same result, it always happens when calling the start method.

Tested with AIR SDK 50.2.2.4.4 and 50.2.2.4.5

I test the AIR SDK 51.0.0.4 but get the same result

Sound that the problem is: [UIView setAnimationsEnabled:] and UIWindowScene windows on non-main thread

ajwfrost commented 7 months ago

Hi

Just checking on this one: if you have a "BackWorker.swf" file that is an actual SWF file, containing ActionScript code (or even if not, unless you pre-process it, it will likely have a class initialiser generated in ActionScript) .. then, this is not allowed in iOS and the app will try to display a warning. I'm finding that the display of the warning is throwing an exception, although I don't know whether this is exactly the thing you're seeing. Are you able to get the IPS crash report and post that here so that we can check?

The better option is to load in the SWF dynamically from your external SWFs list, or just use the main SWF file and reuse that with an "if primordial then launch the worker and then continue, else do the worker stuff" construct. See the final option under https://help.adobe.com/en_US/as3/dev/WS2f73111e7a180bd0-5856a8af1390d64d08c-7fff.html

thanks