Class: FiberAudit::Static::Rules::Synchronization

Inherits:
Base
  • Object
show all
Defined in:
lib/fiber_audit/static/rules/synchronization.rb

Overview

FA1003: Thread synchronization primitives that may interfere with fiber scheduler cooperation. Advisory rule with :low default.

Detects Mutex, ConditionVariable, Monitor, and MonitorMixin synchronization operations. try_lock is treated as :info since it's non-blocking but indicates thread-oriented synchronization.

Constant Summary collapse

RULE_TITLE =
'Thread synchronization'
RULE_CATEGORY =
:synchronization
TARGETS =
OperationVocabulary::FA1003_TARGETS
TRY_LOCK_MSG =
'Mutex#try_lock is non-blocking and identifies a thread-oriented coordination point.'
NORMAL_MSG =
'Synchronization contention requires scheduler block/unblock cooperation in a non-blocking Fiber.'
REMEDIATION =
'Verify scheduler coordination and contention behavior under load; investigate correlated stalls.'

Constants inherited from Base

Base::CONTEXT_CEILING

Instance Method Summary collapse

Methods inherited from Base

confidence, default_confidence, default_severity, description, id, #initialize, severity

Constructor Details

This class inherits a constructor from FiberAudit::Static::Rules::Base

Instance Method Details

#analyze(call_sites:) ⇒ Object



31
32
33
34
35
36
# File 'lib/fiber_audit/static/rules/synchronization.rb', line 31

def analyze(call_sites:)
  explicit_monitor_mixins = explicit_monitor_mixin_classes(call_sites)
  call_sites.filter_map { |site| check(site, explicit_monitor_mixins) }
rescue StandardError
  []
end