Read lock present after Save

Hello,

We have encountered a quite strange behavior when just loading and saving a Visio diagram. Using the exact same code-snnipet in a Console Application and a ASP. NET Web Application, the issue is present only in the latter.

    string filePath = @"C:\FileStorage\TEST\GDP\GDP10067\GDP10067\1.vsdx";
    string filePath2 = @"C:\FileStorage\TEST\GDP\GDP10067\GDP10067\2.vsdx";
    Aspose.Diagram.License lic = new Aspose.Diagram.License();
    lic.SetLicense("Aspose.Total.lic");
    Aspose.Diagram.Diagram document = new Aspose.Diagram.Diagram(filePath);        
    document.Save(filePath2,Aspose.Diagram.SaveFileFormat.VSDX);

What has been observed:

  • With the console application process still running after the Save() there is no READ lock on file

  • When invoked from an .aspx, running under w3wp.exe process , the input file is locked until the process is restarted.

I have found a workaround by loading the file first into a stream and then passing the stream to Aspose to load the diagram, but I believe that this is a bug.

I attached a sample file, and the last version of Aspose.Diagram,18.10, is used.

1.zip (36.4 KB)

@hssupport

Thanks for contacting support.

Would you please share a bit more details about how you are checking if file is locked during processing. We will test the scenario in our environment and address it accordingly.

Sure.
Firstly, is locked after processing the document.
During initial tests of the Aspose.Diagram, we could not open/copy file at all. A simple test is just copying the file using File Explorer returns the error that “The file is being used by the w3wp.exe process”.

Taking a closer look at the process running it, using the two SysInternals tools, Process Explorer ( it could be seen that a handle is referring the file by the w3wp process) and Process Monitor ( that the CreateFile operation is creating the Lock but never releasing it, even after CloseFile is invoked ).

I hope this gives enough explanation on the scenario.

@hssupport

Thanks for sharing more details.

As per our understandings, your web application is hosted over IIS and it seems common behavior of IIS worker process that it locks the accessed files to avoid the file from being accessed by other threads. We have tested the scenario by building a sample Web Application and running it over localhost and issue could not be reproduced.

Since, you are facing this issue over IIS hosted web applications, it may be related with specific environment. Would you please share your environment details like OS Name and Verison, .NET Framework Version, etc. We will try to reproduce it with provided details and log the ticket accordingly.

Yes, IIS worker process does that, but the question is why is only Aspose.Diagram behaving in this way?
We make use in the exact same manner of Aspose.Slides, Words and Cells and there are no issues there.

We have encountered the issue on both Windows Server 2012 R2 and Server 2016 ( Version 1608 OS Build 14393.2485 ) and .Net version v4.

@hssupport

Thanks for sharing further details.

We have logged complete provided information under the ticket ID DIAGRAMNET-51579 in our issue tracking system for the sake of correction. We will further investigate the scenario and as soon as we have some additional updates, we will let you know. Please be patient and spare us little time.

We are sorry for the inconvenience.

@hssupport

Thanks for contacting support.

We have tested the scenario with Aspose.Diagram for .NET 18.12 and found no issue. Would you please try using latest version and in case you still face any issue, please feel free to let us know.

The issues you have found earlier (filed as DIAGRAMNET-51579) have been fixed in Aspose.Diagram for .NET 19.1.