ObjectDisposedException in Application eventlog when used on IIS

When being used as part of ASP.net through IIS, it looks like something in Aspose.PDF v23.7.0 onwards (including v23.9.0) is generating an ObjectDisposedException approximately 1 minute after the DLL is used to convert HTML to PDF, I presume as part of the GC.

Here is the exception as recorded in the Window Logs / Application section of the event viewer…

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/1/ROOT

Process ID: 12636

Exception: System.ObjectDisposedException

Message: The CancellationTokenSource has been disposed.

StackTrace:    at System.Threading.CancellationTokenSource.ThrowObjectDisposedException()
   at #=zI6IPbUnSyGasiovyiaOrgco=.#=zBdAFb$d7kVumZ55oHw==.#=zG0vjPhoUHLT89n9Q2w==(Object #=zBeVXD7M=)
   at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.TimerQueueTimer.CallCallback()
   at System.Threading.TimerQueueTimer.Fire()
   at System.Threading.TimerQueue.FireNextTimers()
   at System.Threading.TimerQueue.AppDomainTimerCallback(Int32 id)

I do not know if it only happens on HTML to PDF, but that is the only time I’ve seen it.

We were alerted to the issue because it had a really, really strange knock-on consequence where (and I honestly don’t know how) immediately after the exception, the call to our SQL database is corrupted resulting in a “login failed”. It was only when I looked at the Windows Log / Application and tied up the time of the login errors to these exception that I realised that it was because of Aspose.PDF. And I only knew it was Aspose, because of the particular format of obfuscation you use.

The fault was reported on multiple production websites (running on Windows Server 2012, 2016 and 2019), and I was able to replicate on my local development environment (Windows 10)

We have have downgraded our sites to use v23.6.0 as the fault does not occur in that version.

It’s also worth noting that I was unable to replicate the error when using the DLL through a console application, and I’m therefore unable to provide you with an example.

We’re using Visual Studio 15 with ASP.Net 4.5.2.

Many thanks,
Tom

@stonefish

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-55580

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hello,

This problem even occurs in your online PDF converter when converting a HTML file to PDF:
https://products.aspose.app/total/conversion

This is causing serious problems in our clients.
Do you have any update on this issue? Or an estimation when a fix will be provided?

Thanks

Hi Mario,

It’s probably not useful to you, but we managed to get around this issue by dumping Aspose (and their useless “we’ll fix it if you pay for it” approach) and moving to GemBox instead.

Cheers,
Tom

@duvidasAspose

We are afraid that the earlier logged ticket has not been yet fully investigated. We will inform here as soon as it is resolved.

@stonefish

We apologize if you had to choose some other service as a workaround. Please note that the issues are resolved on first come first serve basis in free support model. We only recommend paid support option if an issue is a showstopper and needs to be resolved on urgent basis. We resolve every logged and reported issue regardless the support model under which they were reported. However, the issues logged under paid support have higher precedence over the issues logged under free support model