We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

Service hangs when disposing Viewer in .NET

Hi,

We have a very special problem where our conversion Windows service hangs indefinitely when it tries to release the GroupDocs.Viewer.
Unfortunately the problem only exists on a single VirtualBox VM and only occurs in this Windows service, not in any sample program. The hang is only happening for DWG files (but not a specific file), other file types were working fine.
If I created a dump file of the process, would you be able to see something or will this be a wast of time?
image.png (15.8 KB)
Do you have any other options for advanced logging or can you suggest any monitoring tool?

The Virtual Box VM is running Windows Server 2019 and uses GroupDocs.Viewer 21.8.
I already simplified the GroupDocs call to this:

            using (var viewer = new Viewer(@"C:\airliner_il_-_86.dwg"))
            {
                var htmlViewOpts = HtmlViewOptions.ForEmbeddedResources();
                var viewOptions = ViewInfoOptions.FromHtmlViewOptions(htmlViewOpts);
                var info = viewer.GetViewInfo(viewOptions);
            }

Added logging was showing that GetViewingInfo call is successful, but the next log-line after the closing bracket of using is not reached, so it has to happen on dispose.

Hi @Clemens_Pestuka

I will investigate this issue and reply here.

Hi @Clemens_Pestuka

Might you attach a sample application archive here?

Hi, @mikhail.evgrafov.aspose

The problem is, that the issue does not occur with any sample application.
That’s why I’m asking if you can get any valuable information from only a dump file.
(And the problem also does not occur on any other machine so far.)

Hi @Clemens_Pestuka

About dump file: dump should be created when service hangs. A dump of the current process without any issues would not help.

I can ask you for other information:
Might you look for crashes information into Events (Windows Logs) and save these events in file and attach here (see screenshot)?

Event viewer located in “Control Panel\All Control Panel Items\Administrative Tools”.
Please save crash event entry and some 3-5 entries before and after it entry.
Look at “Application” logs.

Hi @mikhail.evgrafov.aspose,

Unfortunately there was no useful information, only log about the crash of our conversion service.

I have prepared a minimal VirtualBox VM with the issue reproducible.


Password for Administrator is “Pa$$w0rd”
It’s a fresh Windows Server 2019 installation (ISO from our customer) with a small version of our client software installed. As our software is not usable without a server, I’ve written a small test program that calls our conversion service directly.
If you run ConversionServiceTest.exe you will see “loaded” in the event log:
PK office VM hang.png (100.1 KB)
This log entry is coming from our Therefore.GroupDocs.dll which executes this code:
        using (EventLog eventLog = new EventLog("Application"))
        {
            eventLog.Source = "Application";
            eventLog.WriteEntry("loading airliner.dwg.", EventLogEntryType.Information, 101, 1);
            using (var viewer = new Viewer(@"C:\airliner_il_-_86.dwg"))
            {
                var htmlViewOpts = HtmlViewOptions.ForEmbeddedResources();
                var viewOptions = ViewInfoOptions.FromHtmlViewOptions(htmlViewOpts);

                var info = viewer.GetViewInfo(viewOptions);

                eventLog.WriteEntry("loaded", EventLogEntryType.Information, 101, 1);
            }
            eventLog.WriteEntry("released.", EventLogEntryType.Information, 101, 1);
        }

It only logs “loaded” because “released” is never reached.
If you open services (=“Dienste”) you can restart the “Therefore™ Conversion Service” to re-run this test.
The service is hanging at this point, as it’s waiting for GroupDocs.Viewer to be disposed.
The issue does not seem to be related to the file, and happens with all “DWG” files I tested with.

Running other test programs did not lead to the same hang, it only seems to happen with our Conversion Service.

Hi @Clemens_Pestuka

Thank you for detailed response and VM.

Hi @Clemens_Pestuka

Is it possible to try to reproduce this issue outside the ThereFore conversion service? Might you provide a sample application with your code there dispose hang?

Hi @mikhail.evgrafov.aspose,

I was not able to reproduce it with any other program unfortunately.
I will try again, but previous attempts were all working and not hanging.
Why would it make a difference for you though, can’t you use debug versions of your GroupDocs.Viewer.dll, attach to the Conversion service and check where it hangs?

Btw: We got another report from a different customer about the same issue.
They were not using any virtualization.

Hi @Clemens_Pestuka

Ok, we will continue investigating the issue. I have some ideas to reproduce. Please try to get information from the customer to get closer to a solution.

1 Like

Hi @Clemens_Pestuka

Might you tell - is it possible to open Therefore Viewer application? I try to get access to Therefore viewer settings extensions as described here:

i want to change exntesion for viewing from Therefore.GroupDocs.dll to customized dll with test code to reproduce issue for deep debug and tests.
Now when I try to run Therefore Viewer I get DCOM error.

Is it possible to open settings window?

Hi @mikhail.evgrafov.aspose,

I was finally able to write a test program that hangs like our conversion service.
I tried to remove as much code as possible from the conversion service and also replaced most of the DLLs.
It was several days of work… but I also got pretty close to the “trigger”.
In “NotFileConverter” project there is “LoadGroupDocsLicense()” function.
This function is supposed to load the license on conversion service startup, to trigger loading of GroupDocs DLLs. (to reduce loading time on first conversion call)
For that we are using our CTaskRunner to execute it in a background task.
This somehow leads to the hang in GroupDocs.Viewer later.

If you use a std::thread instead (commented out code) the hang does not occur.
So I think we have a workaround at least (not tested at customer’s machine yet), but I’m still interested to know why GroupDocs is hanging in this case.
We did not see any problem with our CTaskRunner class and suspect that it’s rather a timing issue,
that just does not happen with std::thread for some reason.

You should be able to build the attached solution as 64bit release.
If you copy all output files to the VM, executing “TheFileConverterCall.exe” should lead to the hang.
(it sometimes works, the just run it a second time)
If you open the event log, you should see those messages:
loading license
loading airliner.dwg
loaded

If it works, you should also see: “released” in the event log and the test program should close.
The airliner.dwg should exist on the VM. If you want to run it locally, don’t forget to copy it.

GroupDocsHang.zip (1.3 MB)

Hi @Clemens_Pestuka

Thank you for your archive, I also reproduced the issue with COM chain calls, but of course, we will look into this case too.

1 Like