Skip to content

Fail closed on stuck realtime permission verification instead of stalling delivery - #15086

Merged
ArnabChatterjee20k merged 27 commits into
mainfrom
fix/realtime-permission-ingest-fail-closed
Oct 30, 2026
Merged

ArnabChatterjee20k merged 27 commits into
mainfrom
fix/realtime-permission-ingest-fail-closed

Conversation

@ArnabChatterjee20k

@ArnabChatterjee20k ArnabChatterjee20k commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Issue / Description

Tracking: appwrite-labs/cloud#7099

In app/realtime.php, the pub/sub subscribe callback handles permissionsChanged events inline, in the single long-lived subscriber coroutine. That handling reads the platform and project databases through getConsoleDB() / getProjectDB(), which cache the database objects in the subscriber's coroutine context.

If one of those cached connections goes silently dead (half-open TCP), the next permission lookup blocks forever on a socket read. There is no error and no log — the subscriber coroutine is simply parked, and all realtime delivery stops for every project served by that worker. This caused a full realtime outage in production on 2026-10-28.

The inline design exists for a reason that must be kept: the revocation event itself is delivered with the roles the user held until then, events after it see the new roles, and revoked connections are closed only after that delivery.

Solution

Mirrors the MQTT broker's change in #15085, including its shape: the pub/sub event handling moves out of the app/realtime.php subscribe closure into Appwrite\Realtime\Event\Handler (src/Appwrite/Realtime/Event/Handler.php), next to Appwrite\Mqtt\Event\Handler. handle() is the phpredis subscribe callback. Private methods carry the plot: revalidateUser() / revalidateProject() run their checks (checkUser() / checkProject()) through verify(), the bounded child-coroutine wait that records the span, then endDeletedTeams(), deliver(), the closes, and tail(). Dependencies are injected as objects: the WebSocket server, the Realtime adapter, the stats table, the tail registry, usage, the concrete telemetry instruments, the unauthorized exception and payload, and the timeout. The database getters (getConsoleDB() / getProjectDB()) stay the existing overridable global functions, so the Cloud edition's overrides keep working. They are called inside the child coroutine, which is what gives each check fresh database objects. The pub/sub reconnect loop stays in app/realtime.php. Behavior is unchanged by the move: the harness tests boot app/realtime.php and pass with every assertion unchanged.

The behavior, with a bounded wait:

  • Each permissionsChanged branch's database work and subscription rebuild now runs in a child coroutine via go(). The child gets a fresh coroutine context, so it resolves fresh database objects from the pool instead of reusing the subscriber's cached ones, and hands its $closing result back through a Swoole\Coroutine\Channel.
  • The subscriber waits with $channel->pop($timeout). The timeout comes from the new _APP_REALTIME_PERMISSION_TIMEOUT env var (seconds, default 5, clamped to a minimum of 0.1 because a zero or negative Channel::pop() timeout waits forever or not at all), documented in app/config/variables.php.
  • When the child finishes in time (the normal case), behavior is exactly today's: same ordering, same $closing semantics, same telemetry.
  • On timeout or on an error in the verification (for example a failed database read), it fails closed — either way the user could not be verified: the per-user branch closes that user's connections, impersonator connections, and admin-mode connections (all known in memory, no database needed); the project-wide branch closes the project's session-bearing connections (non-empty userId and sessionId, the branch's existing filter) and its admin-mode connections, which the verifier re-checks against the project's team. Impersonated connections are not re-checked by the project-wide verifier, so its failure path leaves them alone too. Each gets the same unauthorized payload and close as the existing $closing flow, and the outcome is recorded on the verification span (below). The triggering event still fans out to everyone else. Failing closed is the right degradation because a reconnect re-authenticates with fresh roles — an unverifiable user is excluded rather than served on stale roles.
  • Each verification records one realtime.permissions span. It is structured and queryable in production, where Console text lines are not. Attributes: project.id, user.id (per-user events only), realtime.event (the event name), realtime.verification (verified | timed_out | failed | coroutine_limit), and realtime.closed (how many connections the verification closed). failed carries the throwable via setError(). timed_out attaches a DATABASE_TIMEOUT ("Permission verification timed out after {timeout}s"), and coroutine_limit attaches a GENERAL_SERVER_ERROR ("Permission verification skipped: coroutine limit reached"). So every failure finishes at error level, and the sampler keeps it past _APP_TRACE_PROJECT_ID / _APP_TRACE_FUNCTION_ID, because it keeps every span that carries an error. A per-event span is used because realtime.pubsub lives for the whole subscription. When handling an event throws, the per-event catch records a realtime.event span with the error. It is created only on failure, so normal firehose traffic adds no log volume.
  • A late-finishing child is abandoned: a shared flag set on timeout makes it skip its writes, and every mutation re-checks that the connection still exists.
  • If go() fails at the coroutine limit, the verification is skipped and the affected connections are closed (logged as skipped: coroutine limit reached). Running it inline in the subscriber would bring back the unbounded hang, and saturation is most likely exactly when stuck children pile up, since a timed-out child stays alive until its read returns.
  • The per-event handling is wrapped in try/catch, so a Throwable in one event logs a single error and the subscribe loop continues instead of unwinding out of $pubsub->subscribe().

Out of scope, deliberately: database-level timeouts, batching of the sessions.delete per-connection lookups, MQTT, and liveness metrics.

Most of the diff is the subscribe closure moving into the new class; the behavioral change is the bounded wait, fail-closed paths and spans described here.

Tests

The regression tests ran locally against a real Swoole realtime server and a real Redis pub/sub. They booted app/realtime.php in its own process, with fake databases injected through its overridable getConsoleDB() / getProjectDB() hooks, and used real websocket clients. At the author's request the test harness is not part of this PR, so the repository does not gain a process harness. The results below are the captured runs.

"Before" is the pre-fix code: main's app/realtime.php for the first four rows, and this branch at a2a716ed27 (before #15089) for the impersonation rows. "After" is this branch at 578e93d8c7.

Scenario Before After
A permission check stuck on a dead database read; does a follow-up event reach other users? ✘ Never delivered: the firehose stalls ✔ Delivered; the stuck user gets the event, then 401, then close
A permission check that errors; is the event still delivered, and is the user closed? ✘ The event is dropped for everyone; the user is left open ✔ Delivered to others; the user gets the event, then 401, then close
Timeout fails closed, and the subscriber keeps running for the next event ✘ Same test as the first row: it fails at the stall before reaching the close ✔ Span timed_out at error level with DATABASE_TIMEOUT attached; realtime.closed = 1
Normal path: a revoked user gets the event, then 401, then close; an active user is rebuilt and keeps receiving Behavior ✔; the test fails only on its new span assertion, as the realtime.permissions span did not exist yet ✔ Same behavior, span verified
Project session sweep with an impersonated connection on the project's session ✘ The impersonated connection is never closed ✔ Closed with 401; span verified, realtime.closed = 2
Project session sweep that times out, with an impersonated connection ✘ The impersonated connection is never closed ✔ Closed with 401; span timed_out, realtime.closed = 1; a guest stays open
Console impersonator during a project's session sweep ✔ Stays open ✔ Stays open (guard against over-closing)

The ⚠ on the first test in the green run is a deprecation notice from the vendored textalk/websocket client, which PHPUnit pins on whichever test loads it first. It is not a failure. The rest of tests/unit/Realtime passes (50 tests). The coroutine-limit path was not exercised: the server's own coroutines share the same limit, so go() cannot be made to fail reliably without breaking the server first.

After (green), branch head 578e93d: 6 tests pass
PHPUnit 12.5.35 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.5.11
Configuration: /usr/src/code/phpunit.xml

testRevokedConnectionGetsEventThenUnauthorizedClose ended in 5265 milliseconds
DtestStuckVerificationFailsClosedAndKeepsDelivering ended in 7262 milliseconds
.testFailedVerificationFailsClosedAndKeepsDelivering ended in 5248 milliseconds
.testSessionSweepClosesImpersonatedConnection ended in 5261 milliseconds
.testSessionSweepKeepsConsoleImpersonatorConnection ended in 5255 milliseconds
.testStuckSessionSweepClosesImpersonatedConnection ended in 7466 milliseconds
.                                                              6 / 6 (100%)

Time: 00:35.758, Memory: 20.00 MB

Permissions Changed (Tests\Unit\Realtime\PermissionsChanged)
 ⚠ Revoked connection gets event then unauthorized close
 ✔ Stuck verification fails closed and keeps delivering
 ✔ Failed verification fails closed and keeps delivering
 ✔ Session sweep closes impersonated connection
 ✔ Session sweep keeps console impersonator connection
 ✔ Stuck session sweep closes impersonated connection

OK, but there were issues!
Tests: 6, Assertions: 71, Deprecations: 2.
Before (red), main's app/realtime.php: stuck, error and normal-path tests

ANSI colour codes stripped from the server log lines. Nothing else edited.

PHPUnit 12.5.35 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.5.11
Configuration: /usr/src/code/phpunit.xml

testRevokedConnectionGetsEventThenUnauthorizedClose ended in 15308 milliseconds
The testRevokedConnectionGetsEventThenUnauthorizedClose test is slow, it took 15.31 seconds!
FtestStuckVerificationFailsClosedAndKeepsDelivering ended in 17298 milliseconds
The testStuckVerificationFailsClosedAndKeepsDelivering test is slow, it took 17.30 seconds!
FtestFailedVerificationFailsClosedAndKeepsDelivering ended in 15265 milliseconds
The testFailedVerificationFailsClosedAndKeepsDelivering test is slow, it took 15.27 seconds!
F                                                                 3 / 3 (100%)

Time: 00:47.873, Memory: 20.00 MB

Permissions Changed (Tests\Unit\Realtime\PermissionsChanged)
 ✘ Revoked connection gets event then unauthorized close
   │
   │ No realtime.permissions span for revoked: nection.id":4,"realtime.inbound_bytes":163,"realtime.success":true,"realtime.response_code":200,"realtime.subscription_mode":"url","realtime.channel_count":1,"realtime.subscription_count":1,"realtime.outbound_bytes":669,"project.id":"test","user.id":"other","span.finished_at":1793273389.979583,"span.duration":0.00016808509826660156}
   │ [Debug][Worker 0] Receivers: 3
   │ [Debug][Worker 0] Connection IDs: [2,3,4]
   │ [Debug][Worker 0] Matched: [{"6ae32e2deed9f169a571":["{\"method\":\"select\",\"values\":[\"*\"]}"]},{"6ae32e2def14ae6ae8dc":["{\"method\":\"select\",\"values\":[\"*\"]}"]},{"6ae32e2def20212ec1e1":["{\"method\":\"select\",\"values\":[\"*\"]}"]}]
   │ [Debug][Worker 0] Event: {"project":"test","roles":["users"],"permissionsChanged":false,"userId":null,"data":{"events":["probe"],"channels":["documents"],"timestamp":"2026-10-29T11:29:49.979+00:00","payload":{"$id":"probe"}}}
   │ [Debug][Worker 0] Receivers: 1
   │ [Debug][Worker 0] Connection IDs: [2]
   │ [Debug][Worker 0] Matched: [{"6ae32e2deed9f169a571":["{\"method\":\"select\",\"values\":[\"*\"]}"]}]
   │ [Debug][Worker 0] Event: {"project":"test","roles":["user:revoked"],"permissionsChanged":true,"userId":"revoked","data":{"events":["users.revoked.update.status"],"channels":["account","account.revoked"],"timestamp":"2026-10-29T11:29:49.980+00:00","payload":{"$id":"revoked"}}}
   │ {"level":"info","action":"realtime.close","span.trace_id":"87a3aea2778ee4957fb2b4c7a1bce476","span.id":"78061a7631138dc3","span.started_at":1793273389.980471,"realtime.connection.id":2,"realtime.success":true,"project.id":"test","user.id":"revoked","realtime.subscriptions_before_close":1,"span.finished_at":1793273389.980483,"span.duration":1.2159347534179688e-5}
   │ Connection close: 2
   │ Server started successfully
   │ {"level":"info","action":"realtime.stats.persist","span.trace_id":"430c4b9c3e803dfd8576f956214d2e85","span.id":"b2e1f8c950c3e684","span.started_at":1793273399.870686,"span.finished_at":1793273399.870798,"span.duration":0.00011205673217773438}
   │
   │ /usr/src/code/tests/unit/Realtime/PermissionsChangedTest.php:245
   │ /usr/src/code/tests/unit/Realtime/PermissionsChangedTest.php:311
   │
 ✘ Stuck verification fails closed and keeps delivering
   │
   │ Follow-up event was not delivered: a stuck permission verification stalled the firehose: 1,"realtime.success":true,"realtime.subscriptions_before_close":0,"span.finished_at":1793273405.279741,"span.duration":1.3113021850585938e-5}
   │ Connection open (user: 2)
   │ Connection close: 1
   │ {"level":"info","action":"realtime.open","span.trace_id":"447a92e11393f6d9228a8989e9cbd5ad","span.id":"96057d15355cf57c","span.started_at":1793273405.281612,"realtime.connection.id":2,"realtime.inbound_bytes":163,"realtime.success":true,"realtime.response_code":200,"realtime.subscription_mode":"url","realtime.channel_count":3,"realtime.subscription_count":1,"realtime.outbound_bytes":699,"project.id":"test","user.id":"frozen","span.finished_at":1793273405.284248,"span.duration":0.0026361942291259766}
   │ Connection open (user: 3)
   │ {"level":"info","action":"realtime.open","span.trace_id":"e010ec315a110f6a0bb8ea3075af8ef9","span.id":"6f4b469778821629","span.started_at":1793273405.284358,"realtime.connection.id":3,"realtime.inbound_bytes":163,"realtime.success":true,"realtime.response_code":200,"realtime.subscription_mode":"url","realtime.channel_count":1,"realtime.subscription_count":1,"realtime.outbound_bytes":669,"project.id":"test","user.id":"other","span.finished_at":1793273405.284543,"span.duration":0.0001850128173828125}
   │ [Debug][Worker 0] Receivers: 2
   │ [Debug][Worker 0] Connection IDs: [2,3]
   │ [Debug][Worker 0] Matched: [{"6ae32e3d45494598c2b7":["{\"method\":\"select\",\"values\":[\"*\"]}"]},{"6ae32e3d456f723ebcd2":["{\"method\":\"select\",\"values\":[\"*\"]}"]}]
   │ [Debug][Worker 0] Event: {"project":"test","roles":["users"],"permissionsChanged":false,"userId":null,"data":{"events":["probe"],"channels":["documents"],"timestamp":"2026-10-29T11:30:05.284+00:00","payload":{"$id":"probe"}}}
   │ Server started successfully
   │ {"level":"info","action":"realtime.stats.persist","span.trace_id":"559306ec2d6ca0989386f2bee0bc4c18","span.id":"92184b174c9cf3ee","span.started_at":1793273415.214195,"span.finished_at":1793273415.214312,"span.duration":0.00011706352233886719}
   │
   │ Failed asserting that null is not null.
   │
   │ /usr/src/code/tests/unit/Realtime/PermissionsChangedTest.php:366
   │
 ✘ Failed verification fails closed and keeps delivering
   │
   │ Triggering event was not delivered to other subscribers: .id":1,"realtime.success":true,"realtime.subscriptions_before_close":0,"span.finished_at":1793273422.576855,"span.duration":1.1920928955078125e-5}
   │ Connection open (user: 2)
   │ Connection close: 1
   │ {"level":"info","action":"realtime.open","span.trace_id":"66f92a7e1dc06b4c265350737d2e8c93","span.id":"c7f216e4d5991a81","span.started_at":1793273422.578572,"realtime.connection.id":2,"realtime.inbound_bytes":163,"realtime.success":true,"realtime.response_code":200,"realtime.subscription_mode":"url","realtime.channel_count":3,"realtime.subscription_count":1,"realtime.outbound_bytes":699,"project.id":"test","user.id":"broken","span.finished_at":1793273422.581117,"span.duration":0.002544879913330078}
   │ Connection open (user: 3)
   │ {"level":"info","action":"realtime.open","span.trace_id":"6551f2e1794f5c1dbdfddf0907e3205b","span.id":"1bbe5f7dfb2fa129","span.started_at":1793273422.581226,"realtime.connection.id":3,"realtime.inbound_bytes":163,"realtime.success":true,"realtime.response_code":200,"realtime.subscription_mode":"url","realtime.channel_count":1,"realtime.subscription_count":1,"realtime.outbound_bytes":669,"project.id":"test","user.id":"other","span.finished_at":1793273422.58141,"span.duration":0.0001838207244873047}
   │ [Debug][Worker 0] Receivers: 2
   │ [Debug][Worker 0] Connection IDs: [2,3]
   │ [Debug][Worker 0] Matched: [{"6ae32e4e8dc4fffacc94":["{\"method\":\"select\",\"values\":[\"*\"]}"]},{"6ae32e4e8de9d6c22382":["{\"method\":\"select\",\"values\":[\"*\"]}"]}]
   │ [Debug][Worker 0] Event: {"project":"test","roles":["users"],"permissionsChanged":false,"userId":null,"data":{"events":["probe"],"channels":["documents"],"timestamp":"2026-10-29T11:30:22.581+00:00","payload":{"$id":"probe"}}}
   │ Server started successfully
   │ {"level":"info","action":"realtime.stats.persist","span.trace_id":"98e9e8b041ac9822f8ac845e2b2387bc","span.id":"e31af108635414dc","span.started_at":1793273432.509174,"span.finished_at":1793273432.50925,"span.duration":7.581710815429688e-5}
   │
   │ Failed asserting that null is not null.
   │
   │ /usr/src/code/tests/unit/Realtime/PermissionsChangedTest.php:416
   │

FAILURES!
Tests: 3, Assertions: 19, Failures: 3, Deprecations: 2.
Before (red), a2a716e (before #15089): impersonation tests

ANSI colour codes stripped from the server log lines. Nothing else edited.

PHPUnit 12.5.35 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.5.11
Configuration: /usr/src/code/phpunit.xml

testSessionSweepClosesImpersonatedConnection ended in 15273 milliseconds
The testSessionSweepClosesImpersonatedConnection test is slow, it took 15.27 seconds!
FtestSessionSweepKeepsConsoleImpersonatorConnection ended in 5260 milliseconds
.testStuckSessionSweepClosesImpersonatedConnection ended in 17275 milliseconds
The testStuckSessionSweepClosesImpersonatedConnection test is slow, it took 17.28 seconds!
F                                                                 3 / 3 (100%)

Time: 00:37.810, Memory: 20.00 MB

Permissions Changed (Tests\Unit\Realtime\PermissionsChanged)
 ✘ Session sweep closes impersonated connection
   │
   │ Expected the unauthorized error frame before the close: fa96e062","span.id":"329cdd9ac5577a9b","span.started_at":1793273459.582963,"realtime.connection.id":4,"realtime.inbound_bytes":163,"realtime.success":true,"realtime.response_code":200,"realtime.subscription_mode":"url","realtime.channel_count":1,"realtime.subscription_count":1,"realtime.outbound_bytes":669,"project.id":"test","user.id":"other","span.finished_at":1793273459.583159,"span.duration":0.00019598007202148438}
   │ [Debug][Worker 0] Receivers: 3
   │ [Debug][Worker 0] Connection IDs: [2,3,4]
   │ [Debug][Worker 0] Matched: [{"6ae32e738e281137e5be":["{\"method\":\"select\",\"values\":[\"*\"]}"]},{"6ae32e738e48c7c19539":["{\"method\":\"select\",\"values\":[\"*\"]}"]},{"6ae32e738e56e6c4bade":["{\"method\":\"select\",\"values\":[\"*\"]}"]}]
   │ [Debug][Worker 0] Event: {"project":"test","roles":["users"],"permissionsChanged":false,"userId":null,"data":{"events":["probe"],"channels":["documents"],"timestamp":"2026-10-29T11:30:59.583+00:00","payload":{"$id":"probe"}}}
   │ {"level":"info","action":"realtime.permissions","span.trace_id":"96bb4367a209e4c40e933f2514c8991b","span.id":"01b7bfb579f66710","span.started_at":1793273459.583753,"project.id":"test","realtime.event":"projects.test.sessions.delete","realtime.verification":"verified","realtime.closed":1,"span.finished_at":1793273459.58394,"span.duration":0.000186920166015625}
   │ {"level":"info","action":"realtime.close","span.trace_id":"107c1f718dc44d28281eb88478a1b76f","span.id":"13b0000ea0e2e263","span.started_at":1793273459.583996,"realtime.connection.id":3,"realtime.success":true,"project.id":"test","user.id":"normal","realtime.subscriptions_before_close":1,"span.finished_at":1793273459.584008,"span.duration":1.1920928955078125e-5}
   │ Connection close: 3
   │ Server started successfully
   │ {"level":"info","action":"realtime.stats.persist","span.trace_id":"5f5350edd554a8713f83c4b5e009e5ef","span.id":"9bae9d1a89f0e273","span.started_at":1793273469.464891,"span.finished_at":1793273469.465139,"span.duration":0.000247955322265625}
   │
   │ Failed asserting that null is not null.
   │
   │ /usr/src/code/tests/unit/Realtime/PermissionsChangedTest.php:257
   │ /usr/src/code/tests/unit/Realtime/PermissionsChangedTest.php:455
   │
 ✔ Session sweep keeps console impersonator connection
 ✘ Stuck session sweep closes impersonated connection
   │
   │ Expected the unauthorized error frame before the close: id":"b97ed23f2efac4db3700f1bdd8db0575","span.id":"a2bc0df25e97c7bb","span.started_at":1793273480.109436,"realtime.connection.id":4,"realtime.inbound_bytes":163,"realtime.success":true,"realtime.response_code":200,"realtime.subscription_mode":"url","realtime.channel_count":1,"realtime.subscription_count":1,"realtime.outbound_bytes":669,"project.id":"test","user.id":"other","span.finished_at":1793273480.109592,"span.duration":0.00015592575073242188}
   │ [Debug][Worker 0] Receivers: 1
   │ [Debug][Worker 0] Connection IDs: [4]
   │ [Debug][Worker 0] Matched: [{"6ae32e881abb2c231576":["{\"method\":\"select\",\"values\":[\"*\"]}"]}]
   │ [Debug][Worker 0] Event: {"project":"test","roles":["users"],"permissionsChanged":false,"userId":null,"data":{"events":["probe"],"channels":["documents"],"timestamp":"2026-10-29T11:31:20.109+00:00","payload":{"$id":"probe"}}}
   │ {"level":"error","action":"realtime.permissions","span.trace_id":"4b5b7f32174fc370ecbf95686c9d1e6c","span.id":"2d1c6f975f66148c","span.started_at":1793273480.110112,"project.id":"frozen-project","realtime.event":"projects.frozen-project.sessions.delete","realtime.verification":"timed_out","realtime.closed":0,"span.finished_at":1793273482.110344,"span.duration":2.000231981277466,"error.type":"Appwrite\\Extend\\Exception","error.message":"Permission verification timed out after 2s","error.code":408,"error.file":"/usr/src/code/src/Appwrite/Realtime/Event/Handler.php","error.line":452,"error.trace":[{"file":"/usr/src/code/src/Appwrite/Realtime/Event/Handler.php","line":325,"function":"verify"},{"file":"/usr/src/code/src/Appwrite/Realtime/Event/Handler.php","line":59,"function":"revalidateProject"},{"file":null,"line":null,"function":"handle"}],"error.trace_truncated":8}
   │ Server started successfully
   │ {"level":"info","action":"realtime.stats.persist","span.trace_id":"582ca79119da58b34e93028a36917a10","span.id":"004f376f2f5b82e5","span.started_at":1793273490.030447,"span.finished_at":1793273490.030569,"span.duration":0.0001220703125}
   │
   │ Failed asserting that null is not null.
   │
   │ /usr/src/code/tests/unit/Realtime/PermissionsChangedTest.php:257
   │ /usr/src/code/tests/unit/Realtime/PermissionsChangedTest.php:499
   │

FAILURES!
Tests: 3, Assertions: 19, Failures: 2, Deprecations: 2.

Benchmarks

Behavior of the poisoning scenario (one permission lookup blocked on a half-open connection), measured by the regression test:

Before After
Delivery to other connections Stalls indefinitely (total outage for the worker) Unaffected; follow-up delivered as soon as the timeout fires
Affected user's connections Kept open on stale roles, silently Closed with the unauthorized payload within _APP_REALTIME_PERMISSION_TIMEOUT (default 5s)
Verification error (failed DB read) Event dropped for everyone, user kept on stale roles Event delivered; affected user closed with the unauthorized payload
Operator signal None A realtime.permissions span at error level, with project, user, event, realtime.verification and realtime.closed
Normal (non-stuck) events — Byte-for-byte today's behavior and ordering

🤖 Generated with Claude Code

ArnabChatterjee20k and others added 2 commits October 29, 2026 14:50
permissionsChanged events were verified inline in the single pub/sub
subscriber coroutine, whose coroutine context caches the platform and
project database objects. A silently dead (half-open) database connection
parked the subscriber forever on a socket read and stalled all realtime
delivery.

Each branch's database work now runs in a child coroutine with a fresh
context, and the subscriber waits at most _APP_REALTIME_PERMISSION_TIMEOUT
seconds (default 5). On timeout it fails closed: the affected connections
are closed unverified, a reconnect re-authenticates with fresh roles, and
delivery moves on. A late-finishing child skips its writes once abandoned.
A Throwable in one event now logs and continues instead of unwinding the
subscription.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Harness/server.php boots app/realtime.php with fake databases through the
overridable getConsoleDB/getProjectDB hooks; the test drives it over real
websockets and pub/sub. A user lookup that blocks forever stands in for a
half-open database connection: before the fix the follow-up event is never
delivered (the subscriber is parked); after it, the unverifiable user's
connections are closed within the timeout and delivery continues. Also pins
the normal path: a revoked connection receives the revoking event with its
old roles, then the unauthorized error, then the close.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@luxor-code-review

luxor-code-review Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review complete. 🟡 5 medium

💬 Inline comments (4)

📍 Findings outside the diff (1) — 🟡 1 medium — defects on lines GitHub can't attach comments to

🟡 Medium — Add _APP_REALTIME_PERMISSION_TIMEOUT to compose env list · docker-compose.yml:346 · file not in diff

// docker-compose.yml
346	      - _APP_LIMIT_REALTIME_QUERIES

The new variable is declared in app/config/variables.php:561 and read in app/realtime.php:353, but it is missing from the environment: list of the appwrite-realtime service in docker-compose.yml. The sibling _APP_LIMIT_REALTIME_QUERIES added alongside it is present at docker-compose.yml:346, so the omission looks like an oversight rather than policy. Operators who set _APP_REALTIME_PERMISSION_TIMEOUT in .env silently get the hardcoded default of 5 seconds.


This PR introduces _APP_REALTIME_PERMISSION_TIMEOUT so the realtime worker bounds how long permission revalidation coroutines may run, closing connections with stale roles when the bound is exceeded instead of waiting indefinitely. The realtime worker threads the timeout through verification, rebuild, and project-wide paths, keeping impersonation and admin-mode handling in the revocation flow. A new unit test exercises the permissions-changed behavior against the realtime harness server.

Files Change
app/config/variables.php, docker-compose.yml New _APP_REALTIME_PERMISSION_TIMEOUT variable with a 5-second default.
app/realtime.php Timeout-bounded permission verification; abandons and closes connections whose revalidation exceeds the bound.
tests/unit/Realtime/Harness/server.php, tests/unit/Realtime/PermissionsChangedTest.php Harness support and a test covering permission-revocation timing.

Reviewed commit: c865c55

@ghost

ghost commented Oct 29, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

Realtime pub/sub processing now uses a dedicated event handler that bounds permission checks, closes affected connections when verification cannot complete, and preserves normal delivery ordering. The change adds configurable timeout settings, telemetry for verification and failed event handling, and generated Compose configuration. Unit coverage exercises handler outcomes, telemetry, and event-span selection.

Latest changes: The latest commit changes the span-case data provider from returning an array to yielding its named cases through an Iterator.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 11
File Change
app/config/variables.php Documents the configurable realtime permission-verification timeout.
app/realtime.php Wires the event handler and telemetry into realtime workers and selects which event spans to export.
apps/console/src/lib/docs/compose-generator/composeData.ts Adds the permission-verification timeout to generated Compose configuration.
docker-compose.yml Sets the permission-verification timeout for the realtime service.
src/Appwrite/Realtime/Event/Handler.php Handles pub/sub events, bounded permission checks, fail-closed cleanup, telemetry outcomes, and failed-event logging selection.
tests/unit/Realtime/Event/HandlerTest.php Covers handler outcomes, telemetry behavior, and failed/slow/traced event-span selection; the latest change yields the named span cases from an Iterator.
tests/unit/Realtime/Event/RecordingAdapter.php Provides a recording WebSocket adapter for handler tests.
tests/unit/Realtime/Event/RecordingCounter.php Records counter updates and their attributes for handler tests.
tests/unit/Realtime/Event/RecordingGauge.php Captures gauge callbacks for handler tests.
tests/unit/Realtime/Event/RecordingHistogram.php Records histogram observations for handler tests.
tests/unit/Realtime/Event/SilentUpDownCounter.php Provides a no-op up/down counter for handler tests.

Reviewed the commits since 1c17d4a · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

6 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (3)
  • php.appwrite.secret-compare-timing (1)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

ArnabChatterjee20k and others added 2 commits October 29, 2026 14:54
A verification that threw was rethrown into the per-event catch, so the
event was dropped for everyone and the user's connections stayed open on
their old roles. An error leaves the user as unverifiable as a timeout,
so both now go through the same fail-closed path ($onFailure), whose log
line says which case happened, and the event still fans out.

_APP_REALTIME_PERMISSION_TIMEOUT is clamped to at least 0.1 seconds, as
a non-positive Channel::pop() timeout waits forever or not at all.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The harness user lookup for `broken` throws. The test asserts the
triggering event still reaches other subscribers, the broken user gets
it then the 401 and close, and a follow-up event is delivered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/realtime-permission-ingest-fail-closed (after).

Metric Before After Change
🚀 Requests/sec 203.17 197.76 ⚪ -2.7%
⏱️ Latency P50 86.56 ms 87.58 ms ⚪ +1.2%
⏱️ Latency P95 197.24 ms 204.68 ms ⚪ +3.8%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 87.58 204.68 12,540 197.76 +7.44
Account 162.03 295.87 660 11.16 +2.84
TablesDB 83.63 160.04 6,820 110.95 +4.82
Storage 83.94 192.4 3,300 54.87 +12.98
Functions 125.26 240.5 1,760 30.09 +11.72

Top API waits (after)

API request Max wait (ms)
functions.create 443.4
storage.files.create 419.95
account.name.update 389.79
storage.buckets.create 373.48
tablesdb.rows.delete 371.45

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Tier B · See the inline comments. Summary

Comment thread app/realtime.php Resolved
Comment thread app/realtime.php Resolved

@luxor-code-review luxor-code-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand to see previous review

Adds a configurable timeout for realtime permission revalidation with fail-closed connection handling, plus unit test coverage.

Key findings

Comment thread app/realtime.php Resolved
Comment thread app/realtime.php Resolved
Comment thread app/realtime.php Outdated
Comment on lines +608 to +616
if ($started === false) {
Console::warning('Coroutine limit reached, verifying realtime permissions inline');

return $verify();
}

$result = $done->pop($permissionTimeout);
if ($result === false) {
return $onTimeout();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 bug · medium

Verification paths without a bound: fallback and abandoned child

When go() returns false (coroutine limit reached), $verifyPermissions runs $verify() inline on the subscriber with no timeout at app/realtime.php:611, reintroducing the indefinite firehose stall the timeout was added to prevent — and because getConsoleDB()/getProjectDB() cache per-coroutine (app/realtime.php:128-176), any half-open connection handed out there is stored in the long-lived subscriber's context, stalling all later delivery. On the normal path, a timed-out child coroutine is never terminated: it stays blocked inside $verify() (app/realtime.php:600), leaking one Swoole coroutine and its pooled database connection per stuck user/project with no cap or cleanup. Both paths violate the bounded-wait guarantee the $permissionTimeout was introduced to provide.

📋 Prompt for AI Agents

In app/realtime.php around lines 598-616: (1) replace the inline return $verify(); fallback at line 611 with fail-closed handling — call $onTimeout() (marking $abandoned) after logging a warning, so the subscriber never blocks unbounded and its Coroutine::getContext cache is never used for permission reads; (2) capture the coroutine id returned by go() (line 600) and after the timeout cancel it via Coroutine::cancel($cid) (handling the cancelled exception in the child's catch), or pass a cancellation flag checked between steps, so a coroutine stuck on a never-returning DB read does not accumulate indefinitely.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tenki-reviewer Part 1 is valid, fixed in ae69a80: at the coroutine limit $verifyPermissions fails closed (skipped: coroutine limit reached) and never verifies inline, so the subscriber never makes a database read.

Part 2 (cancelling the stranded child) is out of scope for this PR, deliberately. This PR bounds how long the subscriber waits, not the database read itself. Bounding the read (driver/query timeouts) is tracked separately. A stuck child now costs one coroutine plus the dead connection it holds. It cannot stall delivery: if such children pile up to the limit, new events fail closed instead of blocking. The MQTT broker's equivalent change (#15085) takes the same approach and does not cancel. Coroutine::cancel() on a read blocked inside the hooked PDO driver is a separate behavior to validate, and belongs with the read-timeout work. Please re-review.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part 1 is confirmed fixed in the diff: $verifyPermissions now calls $onFailure('skipped: coroutine limit reached') when go() returns false, so the subscriber never runs $verify() inline and never makes a database read in the subscriber coroutine's context.

Part 2 (stranded child coroutine accumulation) remains open. The diff shows the timed-out child is never signalled or cancelled after $done->pop($permissionTimeout) returns false — the child continues blocked inside $verify() indefinitely. The $abandoned flag only prevents the child from writing back to connection state, but it does not unblock the coroutine itself. Under sustained DB slowness, one leaked coroutine and one pooled connection accumulate per timed-out event, with no cap or cleanup. The argument that 'new events fail closed at the limit' is correct but circular: the limit is reached faster precisely because old children are not reaped. This part of the original finding is not resolved.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tenki-reviewer Agreed that the stuck child is not reaped and that it holds a pool slot. Two points on why reaping it is not in this PR:

  1. What leaks is the connection the child is stuck on, and that connection is already dead. It cannot serve anyone else, and returning it to the pool would hand the half-open socket to the next caller. One leak needs one dead connection. A burst of events cannot multiply leaks from a single bad connection: each child pops its own connection, and only the dead ones hang. The limit is bounded by Swoole's max_coroutine (100000 by default), far above any realistic count of dead database connections.
  2. The real fix is a bounded database read. That frees the child and its slot on every path (HTTP, workers, realtime), not just this one, and it is tracked as a separate issue. Coroutine::cancel() would only cover this call site, and only if the hooked PDO read is in a cancellable wait. We have not validated that, and we cannot exercise it in the harness, whose fake blocks on a Channel (always cancellable). The MQTT broker's matching change (Bound the MQTT revoke wait and fail closed on verification timeout #15085) makes the same choice.

So this PR bounds the subscriber's wait and fails closed, and freeing the read is left to the read-timeout work. Please re-review with that scope.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part 1 is confirmed resolved in the diff: the coroutine-limit fallback now calls $onFailure('skipped: coroutine limit reached') instead of $verify() inline.

Part 2 remains open as identified. The $abandoned flag prevents stale writes but does not unblock or reap the stuck child coroutine — it continues holding a pooled connection indefinitely after $done->pop($permissionTimeout) times out. The arguments about bounded pool size and a separate read-timeout fix are noted, but the accumulation of unreleased coroutines and dead connections under sustained DB slowness is a real resource-leak with no in-process ceiling below max_coroutine. The original finding called out both paths; only one is addressed here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tenki-reviewer Correction to my earlier reply: you're right about Part 2, and my argument was wrong.

I claimed only dead connections hang, so one leak needs one dead connection, and that the ceiling is max_coroutine. Both are wrong. A slow database makes every timed-out check hold its pool connection, not only checks on dead sockets. The real ceiling is the per-worker database pool, which holds tens of connections. Once stuck checks drain it, handshakes and other permission checks on that worker starve too.

This PR still stops the subscriber from stalling, but it does not release the stuck check's coroutine or connection. That is now tracked as its own follow-up for both realtime and MQTT (appwrite-labs/cloud#7108): bound the read so the connection is discarded, and/or cap in-flight checks and fail closed at the cap. It will come with a regression test that keeps the pool bounded under N stuck checks.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The acknowledgement is noted and the follow-up tracking (appwrite-labs/cloud#7108) is a reasonable way to proceed. However, the diff visible here still shows no mechanism to signal, cancel, or reap the stuck child after 'pop($permissionTimeout)' returns false — 'abandoned' only gates writes, the coroutine and its pool connection remain blocked indefinitely. Part 2 of the original finding is not resolved in this diff, so I cannot close the thread until the bounded-read or in-flight-cap work lands.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in stacked PR #15094 (base: this branch), commit d9ec7f7. Each worker now caps its in-flight permission checks at half its database pool (max(1, intdiv(console pool size, 2))). A stuck check keeps its slot until its read returns. At the cap, a new check is not started and fails closed at once (realtime.verification = check_limit), so stuck checks can hold at most half the pool instead of draining it.

To be clear about what this does and does not do: the stuck child is bounded, not reaped. It still holds its slot and connection until the read returns, and reaping it comes with the database read timeout, appwrite-labs/cloud#7100. With default settings the per-worker pool is 1, so the cap is 1 and one stuck check already holds the whole pool; the cap only stops it from getting worse. The cap also only applies after a timeout, because the subscriber handles events one at a time.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stacked PR (#15094) addresses Part 2 by capping in-flight permission checks, but that diff is not visible in the evidence shown here — only the Handler.php refactor is available for review. In the diff visible here, after 'done->pop($permissionTimeout)' returns false, no signal is sent to the child, no slot is decremented, and no cap is enforced; the coroutine and its pooled connection remain blocked with no ceiling below 'max_coroutine'. The in-flight cap claimed in #15094 is not present in this diff, so I cannot confirm Part 2 is resolved from the evidence available at this tier.

ArnabChatterjee20k and others added 4 commits October 29, 2026 15:05
Running the verification inline in the subscriber when go() fails brings
back the unbounded hang on a half-open database read, and saturation is
most likely exactly when stuck children pile up. Skip verification and
close the affected connections instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Admin-mode connections carry an empty top-level userId, so the project-wide
fail-closed path skipped them, though the verifier re-checks their team on
success. Close them too when verification times out, fails or is skipped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The helper returned on silence as well as on a close, so a dropped
close() went unnoticed. It now passes only on a close frame or a dropped
socket and fails at the deadline otherwise.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Without it in the service environment list, a value set in .env never
reached the realtime server, which silently used the default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ArnabChatterjee20k

Copy link
Copy Markdown
Member Author

@tenki-reviewer Re the finding outside the diff (_APP_REALTIME_PERMISSION_TIMEOUT missing from the compose env list): valid, fixed in 1fd6ce8. It is now in the appwrite-realtime environment in docker-compose.yml and in the console's compose generator (apps/console/src/lib/docs/compose-generator/composeData.ts), next to _APP_REALTIME_TAIL_RATE.

@luxor-code-review

luxor-code-review Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review complete. 🟠 1 high · 🟡 2 medium

💬 Inline comments (3)


This PR rebuilds the realtime connection verification path so that session invalidation and permission changes fail closed: on timeout or error, connections are closed rather than left serving stale roles, and a project-wide sweep re-verifies every subscribed connection after sessions change. app/realtime.php spawns per-connection verify coroutines fed through a bounded channel, rebuilds roles and re-subscribes on success, and closes connections when verification fails or the subscriber abandons the result. New _APP_ variables document the timeout knobs in app/config/variables.php and are wired into docker-compose.yml with a matching composeData.ts docs entry. The E2E-style harness in tests/unit/Realtime/Harness/server.php and PermissionsChangedTest.php spawns a real Swoole worker process and asserts revocation behavior end to end.

Files Change
app/realtime.php Coroutine-based fail-closed verify flow with project-wide session sweep on invalidation
app/config/variables.php, docker-compose.yml, apps/console/.../composeData.ts New _APP_ env knobs, compose wiring, and generated docs data
tests/unit/Realtime/Harness/server.php, PermissionsChangedTest.php Real-process Swoole harness plus permission-revocation integration test

Reviewed commit: 1fd6ce8

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@pkg-pr-new

pkg-pr-new Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@15086

commit: 69387d8

@luxor-code-review luxor-code-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds fail-closed, project-wide realtime re-verification of permissions when sessions are invalidated, with a Swoole coroutine-driven verify flow, new env knobs, compose/docs plumbing, and a real-process E2E harness test.

Key findings

Comment thread app/realtime.php Resolved
The port now comes from the kernel and the log from tempnam, so parallel
runs share neither. Readiness fails fast if the harness died rather than
passing on another listener. The harness leads its own process group and
teardown signals the group, so the Swoole manager and worker go with the
master instead of outliving the test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ArnabChatterjee20k and others added 2 commits October 29, 2026 15:35
The reasoning lives in the PR description; the code keeps only what a
reader needs at each line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each permissionsChanged verification gets a realtime.permissions span
with project.id, user.id (per-user events), realtime.event, the outcome
in realtime.verification (verified, timed_out, failed, coroutine_limit)
and realtime.closed. Timeouts and the coroutine limit finish at error
level; a failure carries its throwable. A failed event records a
realtime.event span with the error. These replace the Console lines,
which were not structured or queryable.

The harness exports spans as JSON, and the tests assert the recorded
outcome for the verified, timed-out and failed paths.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · See the inline comments. Summary

Comment thread app/realtime.php Resolved
The sampler kept only spans carrying a throwable past
_APP_TRACE_PROJECT_ID / _APP_TRACE_FUNCTION_ID, so the realtime
verification timeout and coroutine-limit spans, which finish at error
level without one, could be filtered out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

The subscribe closure in app/realtime.php moves, unchanged in behavior,
into Appwrite\Realtime\Event\Handler, mirroring Appwrite\Mqtt\Event\Handler:
handle() is the phpredis subscribe callback, and private methods carry
the plot: arrival telemetry, revalidateUser/revalidateProject with their
checks run through verify() (the bounded child-coroutine wait and its
span), endDeletedTeams, deliver, the closes, and tail. Dependencies are
injected as objects and concrete telemetry instruments; the database
getters stay the overridable globals, resolved inside the child
coroutine. The reconnect loop stays in app/realtime.php.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ArnabChatterjee20k

Copy link
Copy Markdown
Member Author

Refactor in dbd7233: the pub/sub event handling moved out of the app/realtime.php subscribe closure into Appwrite\Realtime\Event\Handler (src/Appwrite/Realtime/Event/Handler.php), mirroring Appwrite\Mqtt\Event\Handler from #15085. handle(mixed $redis, string $channel, string $payload) is the phpredis subscribe callback, wired with $pubsub->subscribe(['realtime'], $eventHandler->handle(...)). The reconnect loop stays in app/realtime.php. Private methods carry the flow: recordArrival(); revalidateUser() / revalidateProject(), whose checks (checkUser() with resubscribe(), and checkProject()) run through verify(), the bounded child-coroutine wait that writes the realtime.permissions span; then endDeletedTeams(), deliver(), the closes, and tail(). The constructor takes objects only: the WebSocket server, the Realtime adapter, the stats table, EventTailRegistry, Usage, the concrete telemetry instruments plus the worker attributes, the unauthorized exception and payload, the timeout, and the worker id (used for the dev-only debug log). getConsoleDB() / getProjectDB() stay the existing overridable global functions, so the Cloud overrides still apply. They are called inside the child coroutine, so each check gets fresh database objects. Behavior is unchanged: tests/unit/Realtime boots app/realtime.php and passes with every assertion unchanged.

ArnabChatterjee20k and others added 2 commits October 29, 2026 16:04
A level-only span carries no error, so the sampler drops it whenever the
trace filters are set. timed_out now records a DATABASE_TIMEOUT and
coroutine_limit a GENERAL_SERVER_ERROR, each with a short fixed message,
and finishes at error level by default. That keeps them past the filters
without special-casing the shared sampler, so its earlier change is
reverted. realtime.verification is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The project-wide sessions.delete sweep skipped every connection without a
sessionId, and impersonated connections never carry one: they run on the
impersonator's session. After "invalidate all sessions" they kept serving
the target user's data on an invalidated session.

The sweep now checks impersonated connections whose impersonator belongs
to the project, against that impersonator's session, status and
impersonator flag, reading each impersonator once per event. Console
impersonators hold console sessions and are left alone. The fail-closed
path closes the same set.

The harness can now open impersonated and session-bearing connections
and invalidate a project's sessions, and three tests cover the verified,
console-impersonator and timed-out sweeps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ArnabChatterjee20k and others added 2 commits October 29, 2026 16:57
…sion-sweep

End impersonated realtime connections when a project invalidates its sessions
At the author's request, the process harness and the tests that drove it
are not kept in the repository. Their red and green runs are recorded in
the pull request description instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ArnabChatterjee20k

Copy link
Copy Markdown
Member Author

The test harness is removed in 5015e9e (tests/unit/Realtime/Harness/server.php and tests/unit/Realtime/PermissionsChangedTest.php). The regression results are now in the description's Tests section: a before/after table per scenario, and the raw red and green PHPUnit output from real local runs against a Swoole server and Redis.

…y-on-ingest

feat(realtime): telemetry for the pub/sub event handler
…-ingest

feat(realtime): report worker uptime gauge

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · See the inline comments. Summary

Comment thread src/Appwrite/Realtime/Event/Handler.php Resolved

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · Looks good to merge. Summary

Comment thread app/realtime.php Resolved

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant