Commit Graph

65 Commits

Author SHA1 Message Date
Tony Garnock-Jones 581886835a New dataspace pattern implementation; update HTTP server 2024-04-10 17:03:09 +02:00
Tony Garnock-Jones 91b26001d8 There isn't an /etc/mime.types on OSX 2024-04-03 22:32:54 +02:00
Tony Garnock-Jones 94598a574b Update HTTP service protocol 2024-04-01 16:52:24 +02:00
Tony Garnock-Jones a56aec2c30 Tweak tracing in http_router 2024-04-01 15:01:33 +02:00
Tony Garnock-Jones 0c06ae9601 Repair path matching where no explicit PathPatternElement::Rest is present 2024-04-01 14:58:55 +02:00
Tony Garnock-Jones 55456621d4 Handle refinement to gatekeeper protocol allowing JIT binding and/or direct rejection 2024-03-22 11:22:58 +01:00
Tony Garnock-Jones f4a4b4d595 Reuse a single Activation per actor: this merges RunningActor with Activation 2024-03-04 10:07:31 +01:00
Tony Garnock-Jones 56f04786ab New gatekeeper internal-service, for partitioning access 2023-11-24 14:04:33 +01:00
Tony Garnock-Jones a38765affa Static file service 2023-11-14 00:56:10 +01:00
Tony Garnock-Jones 65dae05890 Multiplex regular HTTP on existing TCP/WebSocket connections 2023-11-13 21:52:27 +01:00
Tony Garnock-Jones 1d61ea0c8e Generic pattern_plugin implementation 2023-11-10 23:19:22 +01:00
Tony Garnock-Jones efb76bfe91 Add "never" restart policy 2022-02-06 23:03:21 +01:00
Tony Garnock-Jones 4f0145e161 Sort directory entries in config scan 2022-02-04 16:59:29 +01:00
Tony Garnock-Jones b09fbdceec Remove hardcoded milestones and system-layer notions 2022-02-04 16:00:15 +01:00
Tony Garnock-Jones f88592282d MAJOR REFACTORING OF CORE ASSERTION-TRACKING STRUCTURES. Little impact on API. Read on for details.
2022-02-01 15:22:30 Two problems.

 - If a stop action panics (in `_terminate_facet`), the Facet is dropped before its outbound
   handles are removed. With the code as it stands, this leaks assertions (!!).

 - The logic for removing an outbound handle seems to be running in the wrong facet context???
   (See `f.outbound_handles.remove(&handle)` in the cleanup actions
    - I think I need to remove the for_myself mechanism
    - and add some callbacks to run only on successful commit

2022-02-02 12:12:33 This is hard.

Here's the current implementation:

 - assert
    - inserts into outbound_handles of active facet
    - adds cleanup action describing how to do the retraction
    - enqueues the assert action, which
       - calls e.assert()

 - retract
    - looks up & removes the cleanup action, which
       - enqueues the retract action, which
          - removes from outbound_handles of the WRONG facet in the WRONG actor
          - calls e.retract()

 - _terminate_facet
    - uses outbound_handles to retract the facet's assertions
    - doesn't directly touch cleanup actions, relying on retract to do that
    - if one of a facet's stop actions panics, will drop the facet, leaking its assertions
    - actually, even if a stop action yields `Err`, it will drop the facet and leak assertions
    - yikes

 - facet drop
    - panics if outbound_handles is nonempty

 - actor cleanup
    - relies on facet tree to find assertions to retract

Revised plan:

 - ✓ revise Activation/PendingEvents structures
    - rename `cleanup_actions` to `outbound_assertions`
    - remove `for_myself` queues and `final_actions`
    - add `pre_commit_actions`, `rollback_actions` and `commit_actions`

 - ✓ assert
    - as before
    - but on rollback, removes from `outbound_handles` (if the facet still exists) and
      `outbound_assertions` (always)
    - marks the new assertion as "established" on commit

 - ✓ retract
    - lookup in `outbound_assertions` by handle, using presence as indication it hasn't been
      scheduled in this turn
    - on rollback, put it back in `outbound_assertions` ONLY IF IT IS MARKED ESTABLISHED -
      otherwise it is a retraction of an `assert` that has *also* been rolled back in this turn
    - on commit, remove it from `outbound_handles`
    - enqueue the retract action, which just calls e.retract()

 - ✓ _terminate_facet
    - revised quite a bit now we rely on `RunningActor::cleanup` to use `outbound_assertions`
      rather than the facet tree.
    - still drops Facets on panic, but this is now mostly harmless (reorders retractions a bit)
    - handles `Err` from a stop action more gracefully
    - slightly cleverer tracking of what needs doing based on a `TerminationDirection`
    - now ONLY applies to ORDERLY cleanup of the facet tree. Disorderly cleanup ignores the
      facet tree and just retracts the assertions willy-nilly.

 - ✓ facet drop
    - warn if outbound_handles is nonempty, but don't do anything about it

 - ✓ actor cleanup
    - doesn't use the facet tree at all.
    - cleanly shutting down is done elsewhere
    - uses the remaining entries in `outbound_assertions` (previously `cleanup_actions`) to
      deal with retractions for dropped facets as well as any other facets that haven't been
      cleanly shut down

 - ✓ activate
    - now has a panic_guard::PanicGuard RAII for conveying a crash to an actor in case the
      activation is happening from a linked task or another thread (this wasn't the case in the
      examples that provoked this work, though)
    - simplified
    - explicit commit/rollback decision

 - ✓ Actor::run
    - no longer uses the same path for crash-termination and success-termination
    - instead, for success-termination, takes a turn that calls Activation::stop_root
       - this cleans up the facet tree using _terminate_facet
       - when the turn ends, it notices that the root facet is gone and shuts down the actor
       - so in principle there will be nothing for actor cleanup to do

2022-02-04 13:52:34 This took days. :-(
2022-02-04 13:59:37 +01:00
Tony Garnock-Jones 28b0c5b4d5 One-shot daemons shouldn't be considered ready at all, just complete 2022-02-03 22:56:20 +01:00
Tony Garnock-Jones 7e4654c8f7 Simplify and repair stdout/stderr logging in daemons 2022-01-26 23:37:04 +01:00
Tony Garnock-Jones 4dc613a091 Foundations for causal tracing 2022-01-19 14:40:50 +01:00
Tony Garnock-Jones 3d3c1ebf70 Better handling of activation after termination, which repairs a scary-looking-but-harmless panic in config_watcher's private thread 2022-01-16 00:02:33 +01:00
Tony Garnock-Jones a37a2739a0 Log compiled instructions in config_watcher 2022-01-15 23:23:48 +01:00
Tony Garnock-Jones c3a9525ef1 Track enough information to allow piecing-together of parent/child relationships among actors 2022-01-10 12:52:12 +01:00
Tony Garnock-Jones 7524b634d3 Repair daemon service restarts 2022-01-08 13:54:25 +01:00
Tony Garnock-Jones 6f8fb014f2 Update daemon restart policy defaults to line up better with the new supervisor defaults 2022-01-07 22:05:12 +01:00
Tony Garnock-Jones 41b1708cea Append a [] to config .pr files, for ergonomics of commenting (!) 2022-01-07 17:18:16 +01:00
Tony Garnock-Jones 895a2f676c lifecycle::terminate_on_service_restart; make debt reporter accept a parameter 2022-01-07 17:18:00 +01:00
Tony Garnock-Jones a831b02ca5 Accommodate changes to dataspacePatterns 2021-12-13 15:43:24 +01:00
Tony Garnock-Jones baf98d6c54 Better span naming and logging tweaks 2021-10-08 16:37:17 +02:00
Tony Garnock-Jones 3c42b5eaeb Tweak logging 2021-10-07 22:21:38 +02:00
Tony Garnock-Jones fb744082b9 Only include config files with names ending in .pr 2021-10-07 21:37:24 +02:00
Tony Garnock-Jones ac6f37cf0c Clean up error reporting 2021-10-07 18:10:59 +02:00
Tony Garnock-Jones 40025b90a6 More capability-oriented scripting language 2021-10-07 17:00:04 +02:00
Tony Garnock-Jones 0d7ac7441f stop() and stop_facet(facet_id) now return unit 2021-10-07 16:59:34 +02:00
Tony Garnock-Jones 7b6a2dab76 More interesting config interpreter 2021-10-06 22:03:12 +02:00
Tony Garnock-Jones 7117215963 Binary and text support 2021-10-05 21:11:16 +02:00
Tony Garnock-Jones d87ff4f62f Step toward inferior syndicate processes 2021-10-05 19:10:46 +02:00
Tony Garnock-Jones 280d938cc0 Wait 0.1s instead of 1.0s on config file change 2021-10-05 19:09:32 +02:00
Tony Garnock-Jones 6fb1db4f6b Improve logging 2021-10-04 14:40:39 +02:00
Tony Garnock-Jones 5e3a497c32 First stab at service logging 2021-10-01 22:07:28 +02:00
Tony Garnock-Jones ea7e13b0c0 Begin teasing out general process specification schema 2021-09-30 16:02:39 +02:00
Tony Garnock-Jones b373d3440a Improve names used for definitions in externalServices.prs 2021-09-30 15:38:40 +02:00
Tony Garnock-Jones ed12c0883e Switch to parking_lot for another performance boost 2021-09-30 13:32:41 +02:00
Tony Garnock-Jones de795219af Fix up daemon retry logic. Also: named fields; better stop logic.
In particular:

1. The root facet is considered inert even if it has outbound
assertions. This is because the only outbound assertion it can have is
a half-link to a peer actor, which shouldn't prevent the actor from
terminating normally if the user-level "root" facet stops.

2. On stop_facet_and_continue, parent-facet continuations execute
inline rather than at commit time. This is so that a user-level "root"
facet can *replace* itself. Remains to be properly exercised/tested.
2021-09-28 17:10:36 +02:00
Tony Garnock-Jones e8b7fbad0e Repair missing sync_and_adjust call 2021-09-28 15:17:43 +02:00
Tony Garnock-Jones 23fa6629df Cosmetic 2021-09-28 15:17:05 +02:00
Tony Garnock-Jones 013e99af70 Greatly improve service lifecycle handling 2021-09-28 12:53:18 +02:00
Tony Garnock-Jones a263a7091d Tweak debug outputs 2021-09-26 11:02:55 +02:00
Tony Garnock-Jones d3d088418f Dependency tracking, milestones 2021-09-24 16:15:26 +02:00
Tony Garnock-Jones b81e936caf Use `enclose!` macro 2021-09-23 21:46:10 +02:00
Tony Garnock-Jones a92647b740 Signal running only once spawn has started 2021-09-20 23:32:53 +02:00
Tony Garnock-Jones 9f316ac659 Implement daemon service 2021-09-20 16:42:35 +02:00