Skip to content

Messaging and Orleans defect patterns

This page lists defects in ConnectSoft event messaging and in Orleans grain code. Messaging defects rarely fail a unit test: the publisher's tests and the subscriber's tests each pass on their own, and the event is lost between them. Grain defects often appear only on a real silo, under the activation scheduler. Each pattern names the symptom, the cause, what to look for in a review, and how to prove the code is sound. The rules these patterns break are on the messaging and Orleans page.

Events, routes and projections

CS-DP-MSG-001: Handler registered but the publisher never routes the event

Severity: blocker · Applies to: service, template · Enforced by: manual · Status: active

Symptom

The handler, publisher and API tests are green, yet the consumer never reacts in a deployed environment.

Cause

Delivery is decided by the publisher's subscription settings. Registering a handler in the consumer changes nothing on the wire.

Check

A new event or event handler without a matching subscription entry in every settings file of the publisher.

Test

A route check that compares every registered handler with every publisher's routing table, and that reports how many handlers it checked, plus an end-to-end test across the two services.

CS-MSG-002, CS-MSG-004

CS-DP-MSG-002: New subscriber route lacks its deployment overrides

Severity: major · Applies to: service, template, pipelines · Enforced by: manual · Status: active

Symptom

In a test environment, the subscriber receives nothing while the publisher reports success.

Cause

The publisher's settings point the new subscriber at the development cluster, and only the deployment pipeline's overrides retarget it. Without them, where several environments share a machine, the messages go to another environment's silo.

Check

A new subscriber entry in the settings without matching override entries in the deployment pipeline for each environment.

Test

A deployment check that every subscriber has its cluster, service and endpoint overrides, and a read of the deployed settings.

CS-MSG-004, CS-CFG-010

CS-DP-MSG-003: Projected field written only by change events never gets its initial value

Severity: major · Applies to: service, template · Enforced by: manual · Status: active

Symptom

A rule that reads a projected field misses most records, and a value that the tests cover never appears in live data.

Cause

The projected field starts empty, and only a "changed" event writes it. No creation event carries the initial value, so a record that never changes keeps an empty field.

Check

Projection fields whose only writer handles change events.

Test

Project a creation event alone, and assert that the field holds the initial state.

CS-MSG-007

CS-DP-MSG-004: Event field promised to subscribers is read by none

Severity: major · Applies to: service, template · Enforced by: manual · Status: active

Symptom

A subscriber acts on a change, for example by raising an alert, that the producer marked as a case to ignore.

Cause

The producer adds a field and documents it as telling subscribers how to act, but no handler reads it.

Check

New fields on an event that are meant to change subscriber behaviour. Search the consumers for each field, and treat a comment that describes consumer behaviour as a claim that needs a test.

Test

A handler test in each subscriber for each value of the field.

CS-MSG-002, CS-DOD-002

Outbox and registration

CS-DP-MSG-005: Outbox dispatcher is woken before the transaction commits

Severity: major · Applies to: library, service, template · Enforced by: manual · Status: active

Symptom

Most events between services arrive in under a second, but a few wait until the next periodic sweep, tens of seconds later, with no retry recorded.

Cause

The publish path signals the dispatcher inside the unit of work. The dispatcher wakes before the commit, finds no row, and the message waits for a later signal or for the periodic sweep.

Check

A dispatcher signal issued from inside the transactional publish instead of after the commit.

Test

An integration test that publishes one message on an idle host and asserts that it is dispatched well within the periodic sweep interval.

CS-MSG-008, CS-MSG-003

CS-DP-MSG-006: Two registrations of one bus interface, and the last one wins silently

Severity: major · Applies to: library, service, template · Enforced by: manual · Status: active

Symptom

With two messaging stacks enabled, events go through only one of them, and a stack registered with TryAdd is skipped.

Cause

Each stack registers the same bus interface with AddSingleton. Dependency injection resolves the last registration and ignores later TryAdd calls, without an error.

Check

  • Several optional modules that register the same service interface.
  • A mix of Add and TryAdd registrations for one interface.

Test

A container test for each combination of modules that asserts which implementation resolves and that the others are reachable by key.

CS-MSG-009, CS-MSG-006

Grains and the Orleans runtime

CS-DP-MSG-007: Grain continuation leaves the activation scheduler

Severity: blocker · Applies to: service, library, template · Enforced by: manual · Status: active

Symptom

A grain method fails with "Activation access violation", or the API returns 500, when the method writes state, touches a reminder or calls another grain after an await.

Cause

.ConfigureAwait(false) in grain code resumes the continuation on a thread-pool thread, and grain services may only be used from the activation's own scheduler.

Check

Any .ConfigureAwait(false) on an await inside a grain method body.

Test

A grain test on a test-cluster silo that awaits an external call, then writes state and registers a reminder.

CS-ORL-001, CS-ASY-002

CS-DP-MSG-008: Grain hangs for the full request timeout on sync-over-async code

Severity: major · Applies to: service, library, template · Enforced by: manual · Status: active

Symptom

A grain call times out after the Orleans request timeout, and diagnostics show one long-running work item with another queued behind it.

Cause

A processor called from the grain blocks with .GetAwaiter().GetResult(), for example a publish inside a transactional callback. The blocked call occupies the single-threaded activation scheduler, on which its own continuation is queued.

Check

A grain that awaits a domain processor directly when the processor, or anything it calls, blocks on a task. Remove the blocking call, or move the call off the activation scheduler at the grain boundary with await Task.Run(...).

Test

A test-cluster test that drives the grain path end to end and asserts completion well within the request timeout.

CS-ORL-002, CS-ASY-003, CS-ASY-006

CS-DP-MSG-009: Grain library loses its code generator through a transitive change

Severity: blocker · Applies to: service, library, template · Enforced by: manual · Status: active

Symptom

After an Orleans package upgrade, hosts report "Could not find an implementation for interface" for the library's grains, while the build and the unit tests pass.

Cause

The library relied on a runtime package to bring in the Orleans code generator transitively. A new runtime version dropped that dependency, and the generator stopped running without an error.

Check

Projects that contain grains or grain interfaces without a direct reference to the Orleans SDK package that carries the generator.

Test

A test that inspects the built assembly for generated code and for the application-part attribute.

CS-ORL-006, CS-DEP-006

CS-DP-MSG-010: Fake clock jump replays timers and hangs the host

Severity: major · Applies to: service, template · Enforced by: manual · Status: active

Symptom

Acceptance tests hang before any step runs, which looks like a database or transport hang.

Cause

The test moves a FakeTimeProvider from its default start year to the present, and the Orleans timers that use the provider replay every skipped period.

Check

SetUtcNow far from the provider's start value in a hook, or a fake clock constructed without the test's baseline.

Test

Construct the fake clock at the baseline time, and keep the hang detector on in the acceptance run.

CS-ORL-005, CS-TIM-004

CS-DP-MSG-011: Duplicate host process with a fixed silo identity stops the original

Severity: major · Applies to: service, pipelines · Enforced by: manual · Status: active

Symptom

A healthy service stops with nothing in its own log, and the operating system event log shows a fail-fast message about an older clone.

Cause

A restart script reads one slow health probe as a dead process and starts a second instance. With a fixed cluster identity and fixed ports, the cluster evicts the original, and the duplicate then fails to bind its ports.

Check

  • Restart or supervision scripts that start a process without confirming that the old one and its ports are gone.
  • Silo endpoints hard-coded in settings.

Test

A check in the restart script that waits for the old process to exit and for its ports to be free before it starts a new one.

CS-ORL-007