shashank created CAMEL-27109:
--------------------------------

             Summary: camel-sanitizer - rule R3b: watch windows for accesses 
that overlap in time
                 Key: CAMEL-27109
                 URL: https://issues.apache.org/jira/browse/CAMEL-27109
             Project: Camel
          Issue Type: Improvement
          Components: camel-core
            Reporter: shashank
            Assignee: shashank


Step 4 of the order of work in the exchange sanitizer design 
({{design/exchange-sanitizer.adoc}}, CAMEL-26630), second part: the sampled 
watch windows of rule R3 (one thread at a time), after the {{AsyncProcessor}} 
contract of R3a (CAMEL-26966).

An exchange can move between threads, but it must never be used by two threads 
at the same time. At a sample of the points where the routing engine uses an 
exchange (a step is called, the callback of a step continues the exchange, an 
on completion runs), the sanitizer opens a short watch window on the exchange, 
during which that thread pauses. If another thread uses the same exchange at 
one of these points during the window, both are reported with their stacks, as 
a new violation kind. A thread that only waits (such as the caller of a circuit 
breaker waiting for its task) uses nothing and is not reported. The return of 
{{process}} is not such a point.

Options:
* {{camel.sanitizer.overlapSampling}}: open a window at every Nth point. 0 
(off) by default, also with profile dev; 100 in a test marked by the JUnit 
extension. With 0 nothing is installed.
* {{camel.sanitizer.overlapWindow}}: how long the thread pauses (default 1 ms, 
on the system clock, so a virtual clock of camel-test-dst does not stretch it).
* A test class can turn the sampling off for itself with 
{{@CamelSanitizer(overlapSampling = 0)}}, for a test that fails only because of 
the pauses (a short timeout, a throttler).

The windows are keyed by the exchange id and the identity hash of the exchange, 
and hold no exchange and no thread. A copy that keeps the id of the exchange 
(such as one rebuilt by the netty or mina {{transferExchange}} in the same JVM) 
is a different exchange and is not reported. An exchange that already has a 
violation of R1, R2 or the R3a contract gets no overlap report (two threads 
continuing such an exchange overlap because of that violation), and each 
exchange gets at most one overlap report.

On camel-core with the sanitizer on and a window at every 100th point, no core 
EIP is reported. The runs on the test suites of the async components (netty, 
netty-http, vertx-http, JMS request/reply), which the design asks for, follow 
separately.

_Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to