Possible Save / Close bug when stressed...

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Possible Save / Close bug when stressed...

Post by DSSavant »

First off, sorry about this post. My Quality Assurance department tends to like to stress my code beyond reasonable measures. Having said that, I think they uncovered a bug in the viewer code or possibly a setting in _my_ code that I have not set properly.

I have reproduced the issue using the FullDemo project shipped with the SDK. My current version is 2.5 (build 194).

Gut the b_OpenDoc_Click method and replace it with what is shown below. The main problem occurs when the viewer is stressed by being told to open, save, close a document repeatedly. In the loop below, I typically blow up on the first iteration when DoEvents is commented out or the second iteration when DoEvents is left in. Two different bugs depending upon DoEvents being present.

The comments in the code describe the problem more. I have attached the PDF for your tests if you wish to use it.

Code: Select all

private void b_OpenDoc_Click(object sender, EventArgs e)
{
	try
	{
		object dataIn = null;
		object dataOut = null;

		for (int i = 0; i < 10; i++)
		{
			// This document has "On Load" javascript that will rotate the page thereby causing it
			// to go "dirty".
			dataIn = @"C:\Temp\2.pdf";
			System.Diagnostics.Debug.WriteLine("TEST: Loading the document");
			axCoPDFXCview1.DoVerb(null, "OpenDocument", dataIn, out dataOut, (int)PXCVA_Flags.PXCVA_NoUI);
			int activeDocumentId = Convert.ToInt32(dataOut);

			// NOTES:
			// The Save and Close operations are where things get foo-bar'ed.  Two problems exist here.
			//
			// 1. Without the Application.DoEvents() below, the viewer will "freeze" while
			//		executing the Save operation.  You will be able to Break All threads in 
			//		the debugger and see that the main thread is sitting on the DoVerb for 
			//		SaveDocument.
			//
			// 2. Once you add the DoEvents below, you will release some of the contention 
			//		between the out of process viewer and the UI host.  Now the code will 
			//		burp in the Close operation and show the "Confirm Document Save" dialog asking
			//		"Do you want to save changes before closing?".  Please note that I have 
			//		indicated NoUI in my flags to Open, Save, and Close.
			//
			//		This bug is even worse than just showing the UI.  Since I'm in a loop, the
			//		thread in *this* process will continue to execute.  Pretty soon I will have
			//		several dialogs asking me if I want to save or not when using the debugger  
			//		to step through the code.  When I "just let the debugger run", I will only 
			//		get one dialog.  If I press NO, then life will continue.  If I press YES,
			//		well, life goes bad very quickly as the out of process viewer tries to save
			//		a document that is no longer there.  The viewer ends up dying in the end.
			//

			Application.DoEvents();
			
			System.Diagnostics.Debug.WriteLine("TEST: Saving the document");
			dataIn = new object[] { activeDocumentId, @"C:\Temp\2.pdf.saved" };
			axCoPDFXCview1.DoVerb(null, "SaveDocument", dataIn, out dataOut, (int)PXCVA_Flags.PXCVA_NoUI);

			System.Diagnostics.Debug.WriteLine("TEST: Closing the document");
			axCoPDFXCview1.DoVerb(null, "CloseDocument", activeDocumentId, out dataOut, (int)PXCVA_Flags.PXCVA_NoUI);
		}
	}
	catch (Exception exception)
	{
		return;
	}
}
As always, scream if you need more.
You do not have the required permissions to view the files attached to this post.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Possible Save / Close bug when stressed...

Post by Corwin - Tracker Sup »

Hello DSSavant,

I was unable to reproduce your problems here. Please update Viewer to build 195 and report back if problem still exists.
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: Possible Save / Close bug when stressed...

Post by DSSavant »

Completely uninstalled prior version of the viewer.
Removed dead folder found in Program Files after uninstall.
Reinstalled build 195.
Made the updates to the method as indicated above.
Recompiled.
Ran without breakpoints.
Pictures of the breakage is in the attached PDF file (in the ZIP).

I'm running a 64-bit, Windows 7, fully patched, etc. box.
Scream if you need more.
You do not have the required permissions to view the files attached to this post.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Possible Save / Close bug when stressed...

Post by Vasyl - PDF-XChange »

Hi, DSSavant.

We investigated this problem again and found one potential bug in our code, will fix it in the next build.
Thanks for your report and please wait for next build...

Best
Regards.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: Possible Save / Close bug when stressed...

Post by DSSavant »

I noticed I had build 194 installed and so upgraded to 195. Alas, same basic problem.

My company needs to ship its next version in the next four weeks. To that end, we are kind of stuck as the "Save Issue" is manifesting itself in two very common user scenarios.

Do you know when your next build will be?
OR
Can I get a one-off build with this fix in it so I can package it with my product?
OR
Is there a work around I can do to avoid the issue altogether?

Any help is appreciated at this point!
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7361
Joined: Wed Mar 25, 2009 10:37 pm

Re: Possible Save / Close bug when stressed...

Post by Paul - PDF-XChange »

HI DSSavant,

there is a planned build slated for the end of this month. Will that work for you?
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: Possible Save / Close bug when stressed...

Post by DSSavant »

End of this month will work fine. Thank you very much!
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7361
Joined: Wed Mar 25, 2009 10:37 pm

Re: Possible Save / Close bug when stressed...

Post by Paul - PDF-XChange »

:-)
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: Possible Save / Close bug when stressed...

Post by DSSavant »

Just checking in. Are we still on track for sometime this week / early next week for another build?

Thanks!
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19876
Joined: Mon Jan 12, 2009 8:07 am

Re: Possible Save / Close bug when stressed...

Post by Stefan - PDF-XChange »

Hello DSSavant,

The current plans are for Thursday or Friday this week - so yes we are still on track for the end of this month.

Best,
Stefan
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: Possible Save / Close bug when stressed...

Post by DSSavant »

I have downloaded 196 and it appears to fix the problem with one caveat. The code example above and partially repeated here:

Code: Select all


         // blah blah blah

         Application.DoEvents();
         
         System.Diagnostics.Debug.WriteLine("TEST: Saving the document");
         dataIn = new object[] { activeDocumentId, @"C:\Temp\2.pdf.saved" };
         axCoPDFXCview1.DoVerb(null, "SaveDocument", dataIn, out dataOut, (int)PXCVA_Flags.PXCVA_NoUI);

will freeze in the debugger when executing the DoVerb for SaveDocument. Freeze means that the thread goes into DoVerb and Never Ever returns. Ever.

Commenting out "Application.DoEvents();" appears to get around the problem. I am concerned though since I cannot guarantee how or what the user will do when interacting with the viewer and asking me to save. If this issue can still be reported to the development department, that would be dandy. For now, I'm letting my QA department know it is "fixed". If they find issues, I will get back with you.

Thanks.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Possible Save / Close bug when stressed...

Post by Vasyl - PDF-XChange »

Hi, DSSavant.

We will investigate this issue. Thanks for the report.

Best
Regards.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19876
Joined: Mon Jan 12, 2009 8:07 am

Re: Possible Save / Close bug when stressed...

Post by Stefan - PDF-XChange »

Hello DSSavant,

As Vasyl said - we will investigate this, and so I have created a ticket:
#1128: Possible save/close bug when stressed.
Which will help us follow all this, and we will post here when there are any news.

Best,
Stefan
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19876
Joined: Mon Jan 12, 2009 8:07 am

Re: Possible Save / Close bug when stressed...

Post by Stefan - PDF-XChange »

Hello DSSavant,

We could not reproduce this issue on our end, so could you please try with build 198 - and let us know if this problem still persists.

Best,
Stefan
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: Possible Save / Close bug when stressed...

Post by DSSavant »

Please close. I can reproduce this on my box but you cannot. At this point I have a work around and am using it.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19876
Joined: Mon Jan 12, 2009 8:07 am

Re: Possible Save / Close bug when stressed...

Post by Stefan - PDF-XChange »

Thanks DSSavant,

Closing the ticket.

Best,
Stefan