Adobe-CEP / CEP-Resources

Tools and documentation for building Creative Cloud app extensions with CEP
https://www.adobe.io/apis/creativecloud/cep.html
1.61k stars 827 forks source link

CSInterface.evalScript crashes Illustrator #338

Open chris-at-cimpress opened 3 years ago

chris-at-cimpress commented 3 years ago

I'm seeing intermittent behavior where our custom CEP extension can cause Illustrator 2020 (24.3) to crash. This seems to happen during a call to CSInterface.evalScript that is attempting to run code on the host application. The host-side code doesn't actually run as far as my limited logging shows. Unfortunately, I cannot provide a sample project. My hope is that the crash report that I will attach to this issue will shed some light.

This crash is more likely to occur when the host-side code is making numerous, repeated updates to the application DOM to add/remove images backed by image files on the file system. There is also a lot of tag manipulation. When the crash occurs, however, the host-side code is not engaged in that behavior.

Best I can tell, Illustrator is trying to deallocate a string in ICUConverter and is trying to free an invalid pointer. Can you shed some light on what is happening here so we can avoid this crash?

crashreport2.txt

ErinFinnegan commented 3 years ago

Almost all Adobe offices are closed for the Winter Break at the moment, until January 4th.

Errors like this that are hard to reproduce on extensions that can't be shared are hard to troubleshoot. Does the crash only happen with Illustrator? If you develop for several apps, and this only happens on Illustrator, it's an Illustrator issue more than a CEP issue. Sometimes I've gotten traction by emailing sharewithai@adobe.com, or occasionally you can get help in the Illustrator prerelease forum, or here.

If you work for a large Enterprise, and this is urgent, you might consider contacting paid support. (But they are also on vacation at the moment.)

untoldbyte commented 3 years ago

The crash is related to how Illustrator's extendscript is behaving with repeated allocation and deallocation of variables

One thing that might sound unlikely but does infacf work is to not store LIVE DOM nodes into javascript variables. Instead just use the whole path eg. app.activeDocument.selection. .. u get the point

Also make sure that you have correct CEP file versions i.e. CSInterface for CEP9 In 9 and so on..

chris-at-cimpress commented 3 years ago

I appreciate the suggestions. Unfortunately, avoiding references to live DOM nodes is not feasible for my extension. We're creating and removing nodes all the time. I've also replicated this crash under CEP 10.

matthewreiter commented 3 years ago

The crash was caused by reading the file field out of a placed item after it was embedded; apparently there was a race condition between accessing the placed item and it getting cleaned up. The solution was to do this before calling embed().