Envelope never routed after server crash

Issue #39 resolved
Christophe de Vienne
created an issue

When the server crash while handling an incoming envelope, there is a case where the emitter node output status in the graph is updated, but the route is never setup hence the process gets stalled. Also the emitter may or may not receive the envelope ack.

This is because the handleEnvelope function is not in a single transaction, and being stopped before the end results in an inconsistent state.

The following data comes from a database just after such a case:

xbusd=# select node_states from process_state where process_id = '64fd9d68-3946-4bf0-b53f-53012d213140';
{
  "9249eeac-c217-4ada-8ad2-7f659f127c87/odoo-emitter-2": {
    "Status": "done",
    "Input": "done",
    "InputStatuses": {},
    "Output": "done",
    "OutputStatuses": {
      "default": "done"
    }
  }
}

xbusd=# select * from route where process_id='64fd9d68-3946-4bf0-b53f-53012d213140';
 envelope_id | id | process_id | source 
-------------+----+------------+--------
(0 rows)

Comments (6)

  1. Christophe de Vienne reporter

    [services/broker] Force route calculation before updating reception status

    Logically we should calculate the route after updating the status, but if the server crashes we would have route-less receptions that would be hard to track and fix. Switching the two operations is harmless: a reception-less route will become used as soon as the emitter re-attempt its sending. And because the route is present, the emission service will find what to do as soon as it is (re)started

    See #39

    Overall the solution seems ok, we need to do some testing to validate it.

    → <<cset 3b7fbe40f74d>>

  2. Log in to comment