paissaheavyindustries / Triggernometry

Triggernometry is a plugin for Advanced Combat Tracker, intended to extend its built-in trigger system with a variety of different actions and configuration options.
MIT License
264 stars 49 forks source link

A Mutex Bug with sync actions #102

Open MnFeN opened 6 months ago

MnFeN commented 6 months ago

It seems that when a sync action is below another action in a trigger with a mutex to capture, it has a high chance to cause the error below when fired and crashes ACT.

Triggernometry v1.1.7.3 has this bug, but 1.1.6.7 does not.

Trigger:

<?xml version="1.0"?>
<TriggernometryExport Version="1">
  <ExportedTrigger Enabled="true" Source="None" Name="Mutex Bug" MutexToCapture="myMutex">
    <Actions>
      <Action OrderNumber="1" VariableOp="SetNumeric" VariableName="1" VariableExpression="2" ActionType="Variable" />
      <Action OrderNumber="2" VariableOp="SetNumeric" VariableName="3" VariableExpression="4" ActionType="Variable" Asynchronous="False" />
    </Actions>
  </ExportedTrigger>
</TriggernometryExport>

Exception message:

---------------------------
Fatal Error - Unhandled Exception
---------------------------
An unhandled exception has occurred.  ACT may close.
Press Ctrl-C to copy this MessageBox.

System.InvalidOperationException - Mutex Bug (e086d813-370b-405f-8f20-06c9a62def8d) at 2024/3/20 15:04:32' Failed to release mutex 'myMutex'.
   在 Triggernometry.RealPlugin.MutexInformation.Release(Context ctx)

   在 Triggernometry.Action.ExecutionImplementation(QueuedAction qa, Context ctx)

   在 Triggernometry.Action.Execute(QueuedAction qa, Context ctx)

   在 Triggernometry.RealPlugin.ActionThreadProc()

   在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

   在 System.Threading.ThreadHelper.ThreadStart()