You are viewing limited content. For full access, please sign in.

Question

Question

Attempted to divide by zero Error in Workflow Logs

asked on March 14, 2024

I was reviewing the LFWorkflow event viewer log today and noticed this error. Is this a workflow that is causing this error or a Workflow process?


Log Name:      LFWorkflow
Source:        Laserfiche Workflow Service
Date:          3/14/2024 8:11:57 AM
Event ID:      100
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      xxxx
Description:
Timestamp: 2024-03-14 15:11:57.635

Local Time: 3/14/2024 8:11:57 AM

Category: Errors

Machine: xxxx

Severity: Error

Application Domain: Laserfiche.Workflow.Service.exe

Process Id: 38364

Process Name: C:\Program Files\Laserfiche\Laserfiche Workflow 10\Laserfiche.Workflow.Service.exe

Win32 Thread Id: 4884 - 

Thread Name: 

Message: <Exception handlingInstanceId="b8557ed6-3ff7-4816-84b6-3830f959305a">
  <Description>An exception of type 'System.DivideByZeroException' occurred and was caught.</Description>
  <DateTime>2024-03-14 08:11:57Z</DateTime>
  <ExceptionType>System.DivideByZeroException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
  <Message>Attempted to divide by zero.</Message>
  <Source>System.Runtime.Caching</Source>
  <HelpLink />
  <Property name="TargetSite">Void SetTrimStats(Int64, Int64, Int64)</Property>
  <Property name="HResult">-2147352558</Property>
  <StackTrace>   at System.Runtime.Caching.MemoryCacheStatistics.SetTrimStats(Int64 trimDurationTicks, Int64 totalCountBeforeTrim, Int64 trimCount)
   at System.Runtime.Caching.MemoryCacheStatistics.CacheManagerThread(Int32 minPercent)
   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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()</StackTrace>
  <additionalInfo>
    <info name="MachineName" value="xxxx" />
    <info name="TimeStamp" value="3/14/2024 3:11:57 PM" />
    <info name="FullName" value="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <info name="AppDomainName" value="Laserfiche.Workflow.Service.exe" />
    <info name="ThreadIdentity" value="" />
    <info name="WindowsIdentity" value="xxxx" />
  </additionalInfo>
</Exception>
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Laserfiche Workflow Service" />
    <EventID Qualifiers="0">100</EventID>
    <Level>2</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2024-03-14T15:11:57.635558200Z" />
    <EventRecordID>660026</EventRecordID>
    <Channel>LFWorkflow</Channel>
    <Computer>xxxx</Computer>
    <Security />
  </System>
  <EventData>
    <Data>Timestamp: 2024-03-14 15:11:57.635

Local Time: 3/14/2024 8:11:57 AM

Category: Errors

Machine: xxxx

Severity: Error

Application Domain: Laserfiche.Workflow.Service.exe

Process Id: 38364

Process Name: C:\Program Files\Laserfiche\Laserfiche Workflow 10\Laserfiche.Workflow.Service.exe

Win32 Thread Id: 4884 - 

Thread Name: 

Message: &lt;Exception handlingInstanceId="b8557ed6-3ff7-4816-84b6-3830f959305a"&gt;
  &lt;Description&gt;An exception of type 'System.DivideByZeroException' occurred and was caught.&lt;/Description&gt;
  &lt;DateTime&gt;2024-03-14 08:11:57Z&lt;/DateTime&gt;
  &lt;ExceptionType&gt;System.DivideByZeroException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/ExceptionType&gt;
  &lt;Message&gt;Attempted to divide by zero.&lt;/Message&gt;
  &lt;Source&gt;System.Runtime.Caching&lt;/Source&gt;
  &lt;HelpLink /&gt;
  &lt;Property name="TargetSite"&gt;Void SetTrimStats(Int64, Int64, Int64)&lt;/Property&gt;
  &lt;Property name="HResult"&gt;-2147352558&lt;/Property&gt;
  &lt;StackTrace&gt;   at System.Runtime.Caching.MemoryCacheStatistics.SetTrimStats(Int64 trimDurationTicks, Int64 totalCountBeforeTrim, Int64 trimCount)
   at System.Runtime.Caching.MemoryCacheStatistics.CacheManagerThread(Int32 minPercent)
   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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()&lt;/StackTrace&gt;
  &lt;additionalInfo&gt;
    &lt;info name="MachineName" value="xxxx" /&gt;
    &lt;info name="TimeStamp" value="3/14/2024 3:11:57 PM" /&gt;
    &lt;info name="FullName" value="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&gt;
    &lt;info name="AppDomainName" value="Laserfiche.Workflow.Service.exe" /&gt;
    &lt;info name="ThreadIdentity" value="" /&gt;
    &lt;info name="WindowsIdentity" value="xxxx" /&gt;
  &lt;/additionalInfo&gt;
&lt;/Exception&gt;</Data>
  </EventData>
</Event>

We are running Workflow version 11.0.2306.898.

0 0

Replies

replied on March 14, 2024

The only mention I can find of this System.DivideByZeroException exception time happening on a System.Runtime.Caching.MemoryCacheStatistics.SetTrimStats function call is in this Github issue:

[Github] dotnet/runtime: System.Runtime.Caching.MemoryCacheStatistics.SetTrimStats DivideByZeroException #1423

My reading of the Github issue is that it's a rare bug that was fixed in .NET 6 with Don't trim if MemoryCache is already empty. #51762:

Don't trim an empty MemoryCache

There exists the potential for an empty MemoryCache to
be trimmed under memory pressure. When this happens,
the result is a DivideByZero exception. The solution is to
not trim empty caches, since doing so doesn't make
any sense anyway.

While the application is clearly Laserfiche.Workflow.Service.exe, I don't see any Workflow functions in the call stack. This does however suggest that your Workflow server maxed out of available memory which triggered this system function that attempted to reclaim memory by trimming a cache, which failed with this error because the cache was already empty. 

Recommended follow-up actions:

  1. Monitor memory utilization on your Workflow server. Consider configuring threshold-based alerts.
  2. Troubleshoot memory utilization if it's unexpectedly high. RAMMap from the Sysinternals utility suite is a useful tool for this.
  3. Add additional RAM resources to the server to alleviate memory pressure if necessary.
0 0
replied on August 21, 2024

Any idea if installing .NET 6 will resolve the issue since Laserfiche is targeting 4.8? This error happens once every few weeks from what I can tell and appears to be the cause of some Workflow issues we are seeing where we have to restart the Workflow Server services. The rest of the time our memory resources are not maxed out and we haven't found anything specific that runs at the time of this error, so we're just trying to find a resolution.

0 0
replied on August 21, 2024

Installing .NET 6 would have no effect on the issue since Laserfiche Workflow 11 targets .NET Framework 4.8, as you noted. 

What does memory utilization monitoring around when the error occurs show? Is there a gradual ramp over X minutes/hours before the error? Does it suddenly spike Y GB right before? Etc.

0 0
replied on September 11, 2024

I was able to get a memory usage report and for the past week it hasn't gone above 50%, so something else must be causing it.

0 0
replied on September 13, 2024

We recently had a long-running support case for high Workflow memory utilization appear to auto-magically resolve itself after the latest set of Windows .NET updates. Perhaps there was some shared root cause, and it helped your case too. Keep an eye on it.

0 0
replied on October 17, 2024

I am currently testing the October update on our test server and if all is good, we will work on pushing it out to our production environment.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.