Local file storage / file in use message

hi,



Do you have any suggestions on how to deal with:



Unable to add file to the local file storage: path = temp\S\C629ACDC86F79924EA7817D956947D180922CD6F1B5638C60F0E34F205F20664.txt. Inner exception message: The process cannot access the file ‘\fssk01-a\Storage\GroupDocs\DocPreview\temp\S\C629ACDC86F79924EA7817D956947D180922CD6F1B5638C60F0E34F205F20664.txt’ because it is being used by another process.



and as to what are the most likely causes for dealing with this message during document preview? Is it in any way related to the cache cleanup task? Or previewing of documents that match particular criteria? Another example of error message that we get logged:



Unable to add file to the local file storage: path = temp\S\B3F40EAEF1B5E11255864CB81CE335468AB16E6C1F54CE19B67F2077FD3ED732.pdf. Inner exception message: The process cannot access the file ‘\fssk01-a\Storage\GroupDocs\DocPreview\temp\S\B3F40EAEF1B5E11255864CB81CE335468AB16E6C1F54CE19B67F2077FD3ED732.pdf’ because it is being used by another process.



Is there any end-user impact when this error message is logged, what do they get exactly on the front-end when this occurs? Or is this exception caught and automatically retried by GroupDocs library?



regard,s

Greg

Hello Greg,


We are sorry to hear that you have such issue. The issue reason could be that the viewing session stack for any reason and the Viewer tries to access this file twice. To resolve the issue please try reload the Viewer i this will not help - restart your application.

As for how to catch this exception - the best way (also this will speed up loading of the document) is to pre-generating of the cache for the file which will be viewed. To pre-generate the cache you can use such code:
string error;
string url = string.Empty;
HttpRequest request = HttpContext.Current.Request;
url = “http://” + request[“HTTP_HOST”] + “/”;
Groupdocs.Web.UI.DocumentCache cacheDocument = new Groupdocs.Web.UI.DocumentCache(null, Server.MapPath("~/App_Data"),
Server.MapPath("~/App_Data/temp"));
//Select one of the folowing variants of cache type images or HTML
try
{
//If you use HTML based engine
cacheDocument.GenerateHtml(“test.pdf”, url, false);
//If you use image based engine
cacheDocument.GenerateImages(“test.pdf”, null, null, 100);
}
catch (Exception e) {
error = e;
}

Thank you.

What about this exception stack:



message="Application_Error() - unhandled GroupDocs error in website. ?.?: Unable to delete folder from the local file storage: path = temp\S\80AF62A9F40DACA2313194B8ED88B281320A138128836F914E71723FBA0DC4F0.pdf\2015-05-07T08_34_56\r. —> System.IO.IOException: The process cannot access the file ‘2_1.woff’ because it is being used by another process. at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound) at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost) at Groupdocs.Storage.LocalFileStorage.DeleteFolder(String path) — End of inner exception stack trace — at Groupdocs.Storage.LocalFileStorage.DeleteFolder(String path) at ?.?.?(String filePath, ?[] ranges, Int32 totalPages) at ?.?.?(String filePath, Func2 htmlWithImageCreator, String prefixForResourceUrlsInHtml, String prefixForResourceUrlsInHtmlFiles, Nullable1 firstPageParam, Nullable`1 pageCountParam, Boolean usePngImagesForHtmlBasedEngine, Boolean convertWordDocumentsCompletely, Boolean ignoreDocumentAbsence, Boolean saveToCustomTempStorage, Boolean supportListOfContentControls, Boolean supportListOfBookmarks, Boolean embedImagesIntoHtmlForWordFiles) at Groupdocs.Web.UI.Handlers.BaseHandler.?(IUrlsCreator urlsCreator, String path, Int32 pageIndex, Boolean usePngImages, Boolean embedImagesIntoHtmlForWordFiles) at Groupdocs.Web.UI.Controllers.GroupdocsViewerController.GetDocumentPageHtml(String path, Int32 pageIndex, Boolean usePngImages, Boolean embedImagesIntoHtmlForWordFiles)



As you can probably imagine, I would rather see a fix implemented for this on GroupDocs side, than have to try/catch these errors and try to reload the document preview again.

Hello Greg,

Thank you for posting and for using GroupDocs.Viewer.

At this moment we can't reproduce the issue on our side without additional information. Could you please share with us such details of your application : code examples for your controller, widget and interface so we will be able to check them.

About your previous questions:
What do they get exactly on the front-end when this occurs?
Or is this exception caught and automatically retried by GroupDocs library?

Users will get the window with exception of the issue on the front-end side. The GroupDocs.Viewer does not try to open the file with exception repeatedly. The Viewer has synchronization between processes inside one server.

Please come back with your details and we will be glad to help you.

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+