Race Conditions in Timer Management System #4
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Orangemart plugin has multiple overlapping timer systems that can create race conditions, leading to inconsistent payment processing, duplicate operations, and memory leaks.
Root Cause Analysis
1. Dual Timer Systems Checking Same Invoices
Global Timer (Line ~390):
Per-Invoice Timer (Line ~610):
Individual Payment Status Timer (Line ~680):
2. Race Condition Scenarios
Scenario A: Concurrent Invoice Removal
pendingInvoices
Scenario B: Retry Counter Conflicts
retryCounts[paymentHash]
Scenario C: Memory Leak from Orphaned Timers
3. Specific Code Issues
Issue 1: Non-Atomic Operations
Issue 2: Timer Lifecycle Management
Issue 3: Inconsistent State Management
Impact
Steps to Reproduce
/buyblood 10
,/buyvip
, etc.)Proposed Fix
Solution 1: Single Centralized Timer System
Remove the individual payment timers and rely only on the global timer:
Solution 2: Thread-Safe Operations
Add locking mechanisms to prevent concurrent modifications:
Solution 3: State Management Cleanup
Ensure proper cleanup and prevent orphaned resources:
Environment
Severity
🟠 Medium-High - Can cause unpredictable behavior and resource leaks under load
Additional Notes
This issue becomes more pronounced with:
checkIntervalSeconds
settingsThe plugin needs a unified, thread-safe timer management system to ensure reliable payment processing.