Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Acrobat closes after CosNameValue

New Here ,
Jul 04, 2016 Jul 04, 2016

Hello.

I have a file with a lot of elements on page. I use CosObjEnum with my own procedure to enumerate it. But after some iterations (over 10000) acrobat closes after function CosNameValue. In the same time it does not throw any exceptions, just closes. Can anybody tell me what it was?

Thank you.

TOPICS
Acrobat SDK and JavaScript
621
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 04, 2016 Jul 04, 2016

When you run Acrobat in the debugger, do you get any indication why it "closes"?  This closing may actually be a crash. Are you sure you are releasing all resources you are acquiring? Do you have an exception handler in place around the location where you assume the problem occurs?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 04, 2016 Jul 04, 2016

I don't get any indication, acrobat just closes like it is normal exit. Yes, I have exception handler but it was ignored.

When I remove line "CosNameValue(obj);", everything is OK.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jul 04, 2016 Jul 04, 2016

Did you check if the object was valid and of type CosName before you called CosNameValue() on it?

However, even so, it would be throwing an exception. You are using DURING/HANDLER blocks and not trying C/C++ exceptions, right?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 05, 2016 Jul 05, 2016

Yes, I check type of object: if (CosObjGetType(obj) == CosName). Is it enough?

And yes: I use DURING/HANDLER blocks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 05, 2016 Jul 05, 2016

Things to think about. * Is Acrobat stopping or crashing? Very different things. * If you run under the debugger does it stop for an exception? What is in the call stack * Is Acrobat running out of virtual memory? How much is in use at the time of failure? * You say 10,000 iterations+ Is that 10,000 calls to your procedure (which is hardly anything) or 10,000 documents/runs (which is probably too many). * Are you creating new names (ASAtoms in a loop)? There is a low limit.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 06, 2016 Jul 06, 2016

Acrobat is just stoping without any messages. If I run under the debugger it doesn't stop for an exception.

At the time of failure Acrobat uses near 100M memory.

As I wrote I use CosObjEnum and it calls my function 10000+ times. And no, at this moment i do not create any names, i just call CosNameValue.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 06, 2016 Jul 06, 2016

Stopping without messages or a break in the debugger is bad. I have seen this but cannot recall the cause. It may not be a simple API call failure, but we'll have to start on that assumption.

100MB is nothing, no problem there.

Let's look at the ~10,000 calls

* Does this happen on random files, or particular files, or just one file?

* If it's a particular file maybe the problem is a specific object. Suggest you add a counter to try and find the actual count (perhaps write to a file, but remember to fflush).

* If the count is always the same, on a single PDF, suggests the next object has a problem. You could try adding a test to skip the CosName Value on that particular callback. Not a general solution but if it works it confirms a problem file

* Perhaps try running some preflight function which is likely to use the same APIs, see if it fails

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 06, 2016 Jul 06, 2016
LATEST

I get this situation only with 1 file but I have not too many files with a lot of objects.

Counts are always different.

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