iink SDK on Device

iOS SDK - Off-screen Recognition Stability

Hello,

I've currently implemented off-screen recognition using the iOS SDK per the recommendations in the relevant documentation. E.g. using the batch processing API, disabling gestures, etc.

Recognition works fine for a few pages, but when I attempt to process many pages I start getting EXC_BAD_ACCESS errors in MyScript code on random worker threads.

Is this use case expected to be stable? This is the general flow I am using.

https://gist.github.com/mustafardestroyer/b58cfb73f680a903048308de76f40482

"generateText" is called once per page, and errors occur after many pages have been processed. I can share more code if needed.

Thanks!



For what it's worth, I've also run this code extensively with the address sanitizer turned on, so I'm fairly confident there aren't memory issues in my code that could be causing this.

Dear Claire,


thank you for contacting us.


At first sight, I do not see anything wrong in your code. Can you confirm you are using the latest 1.4.1 release of the iink SDK?


When you process the different pages, is the exported result satisfying?


Also, how many pages do you usually process before the crash occurs? How about the memory usage? Do you have enough memory left?


Also, is it possible to have a log, so that we may better understand what causes the crash?


Best regards,


Olivier

> Can you confirm you are using the latest 1.4.1 release of the iink SDK?

Confirmed

> When you process the different pages, is the exported result satisfying?

Yes

> Also, how many pages do you usually process before the crash occurs?

5+ seems to be required

How about the memory usage?

Our usage is high (e.g. 200+ MB), but we don't get any memory warnings from the OS. We are attempting to ship an MVP quickly so we haven't optimized memory usage at this point. My understanding is that EXC_BAD_ACCESS is generally not caused by lack of memory.

The issue is difficult to reproduce, I'll attempt to get a log from a failing run as well as memory usage metrics. 

> Also, is it possible to have a log, so that we may better understand what causes the crash?

This issue can be difficult to reproduce, I'll try to get a log from a true failing run. In my test cases, where this issue does not occur, I do see the following logging:

2020-11-12 18:04:34.711304-0800 AivaNotes[800:831316] Error, -[IINKEditor pointerEvents:count:doProcessGestures:error:]::273 INVALID_ARGUMENT:

2020-11-12 18:04:35.897322-0800 AivaNotes[800:831131] Error, -[IINKEditor pointerEvents:count:doProcessGestures:error:]::272 no trace pending

2020-11-12 18:06:14.835195-0800 AivaNotes[800:831445] Error, -[IINKEditor pointerEvents:count:doProcessGestures:error:]::273 INVALID_ARGUMENT:

2020-11-12 18:06:16.018596-0800 AivaNotes[800:831445] Error, -[IINKEditor pointerEvents:count:doProcessGestures:error:]::272 pointer with same pointerId has a trace already pending

2020-11-12 18:06:24.320621-0800 AivaNotes[800:831729] Error, -[IINKEditor pointerEvents:count:doProcessGestures:error:]::272 pointer with same pointerId has a trace already pending

2020-11-12 18:06:28.559195-0800 AivaNotes[800:831123] offlineDataReceiveStatus : status 2, percent 100.000000

2020-11-12 18:06:28.603967-0800 AivaNotes[800:831729] Error, -[IINKEditor pointerEvents:count:doProcessGestures:error:]::272 pointer with same pointerId has a trace already pending

This is from a test run with 20+ pages so in comparison to the number of strokes processed this logging is relatively infrequent. It may also be worth mentioning that I have 2-3 editors processing pages in parallel.

Dear Claire,


thank you for the log, which gives the answer to your issues:

-The first error, "INVALID_ARGUMENT" occurs because your pointer events array contains an "invalid pointer event" ; I know this is not precise, but it can be an x or y missing, or anything else... when the exception is raised, the better is that you log it, and check what can be wrong in the latter.

-Regarding both other exceptions, they occur either because a pointerDown event is missing ("no trace pending") or a pointerUP ("pointer with same pointerId has a trace already pending") .You can refer to tghe following topic: https://developer-support.myscript.com/support/discussions/topics/16000029713


Best regards,


Olivier

Hey Oliver,

Thanks for the info. Regarding the error logging: we catch these errors, skip the relevant page, and clear the editor before moving on. Most of the time we see these errors only occasionally when processing very many strokes and they don't cause any problems. This would lead me to believe they are not the root cause of the issue. Further, I've added several extra checks to ensure that there can be no pointer up event without a pointer down event.

Is it possible that this error could be caused by an issue internal to MyScript? I believe it could be possible that the EXC_BAD_ACCESS issue is unrelated to this.

Dear Claire,


without further logs, it is difficult to provide with an accurate answer, as we have no clue what can cause the crash. Indeed, on our side, we have daily tests running, but we cannot 100% guarantee we are bug-free.


The idea when you have above exceptions is to understand why these occur. And it seems you correct "a posteriori" when the exceptions occur, while it shall rather be known why you have an invalid stroke array, or why the penDown or penUP are missings.


Once this is done, and if crashes still occur, please provide with new logs. Indeed, without more information, we will not be able to investigate further.


Best regards,


Olivier



Login or Signup to post a comment