Skip to content

Connect: threads slow to open, frequent "bb connect hit a temporary problem" #6450

Closed as not planned

Description

@lucascastellanibr

Summary

Using bb remotely through bb Connect (*.getbb.app), threads are slow to open and sometimes fail to open at all. Very often the UI shows:

bb connect hit a temporary problem. Try again in a moment

This happens many times a day and makes remote use painful.

Versions and environment

Steps to reproduce

  1. Pair a host with bb Connect.
  2. Open the remote URL in a browser and click between threads during normal use.
  3. Threads take several seconds to open; intermittently the "temporary problem" error appears and you have to retry.

Expected vs actual

Expected: threads open quickly and reliably over Connect.
Actual: slow thread loads, and frequent "bb connect hit a temporary problem. Try again in a moment".

Evidence

No matching entries in ~/.bb/logs on the host, so the failure seems to be on the relay side, not the local daemon.

What you ruled out

Suggestion

If the hosted relay can't be kept fast and reliable for free, please consider either:

  1. A paid tier with proper capacity / SLA, or
  2. Letting users self-host the relay (documented relay server + config to point Connect at it).

Either would be much better than the current flaky experience.

Suggested priority

High — affects every remote/Connect user, the only workaround is retrying.

AGENT GENERATED

Activity

  1. added theissue type on Oct 28, 2026
  2. added
    remote
    connect
    partial-repro
    on Oct 28, 2026
  3. bb-slop-cop commented on Oct 28, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority High · Effort Medium. Added remote, connect, and perf; no existing classifications were replaced.
    • Reproduction report: PARTIALLY REPRODUCED · production root-cause confidence low · reproduction label: partial-repro.
    • Finding: controlled gate failures reproduce the generic HTTP 502 response. The production trigger and recurring thread-loading delays remain unverified; the message alone does not establish relay overload.
    • Verification: two clean trusted-main checkouts each pass all 298 Connect tests and 30 focused checks. The report includes the repeatable test command and evidence.
    • No PR: no spontaneous production regression was reproduced, so a safe failing-before/passing-after fix cannot yet be established. Next step: correlate a failing request with stored gate logs and tunnel metrics.

    AGENT GENERATED

  4. fabianlindfors commented on Oct 28, 2026

    @fabianlindfors

    Same for me. Seems to have been particularly bad today. I develop almost exclusively against a remote server and this breaks the app entirely.

  5. salemsayed commented on Oct 28, 2026

    @salemsayed
    Contributor

    Another affected server, with timestamps and ray IDs you can match against gate logs. The origin and the tunnel were healthy throughout. Every failure and every slow response I measured happened in the gate, before the request reached the tunnel.

    Setup: salem.getbb.app, bb 0.47.2-nightly.40565112260.1, Linux dedicated server, Cloudflare colo FRA (ICMP 5.5 ms, TCP connect 6 ms, TLS done at about 20 ms).

    1. Outage window: 2026-10-28 ≈16:44–16:46 UTC, gate returned 502 while our tunnel was connected

    Time (UTC) Request Result
    ≈16:44:00–16:44:45 GET / without a cookie (gate sign-in page, no tunnel) 401 after 0.34, 1.31, 1.83, 0.39, 2.79, 2.85, 2.10, 2.80, 3.07 s
    16:44:53 GET / 502 connect_gate_error, ray a51b6861fbc21976-FRA
    ≈16:45:00–16:45:10 GET / ×15 502 connect_gate_error ×15 (50–230 ms)
    ≈16:46–16:47 GET /__tunnel without a credential (fresh resolveLabel, then the hash check, no tunnel) 401 "invalid credential" after 1.59 s
    ≈16:46–16:47 GET a shared-port host on this account (<machine>--<port>.getbb.app) without a cookie 401 after 3.23 s

    At the same moment:

    • the origin answered 127.0.0.1 in 0.3–1.4 ms;
    • bb connect status said connected;
    • the connect plugin logged no tunnel closed from 15:37:54Z through 17:06Z.

    In apps/connect/src/worker.ts, a cookieless GET / goes resolveLabel → signInPage, and /__tunnel without a credential goes resolveLabel({fresh: true}) → hash mismatch → 401. Neither path touches TunnelDO. The 502 is the catch-all in fetch(). So during this window something on the routing path (most likely D1 via resolveLabel) was slow or throwing. It was not the tunnel or the origin.

    Observability gap: that catch path only does console.error (about 1% retained in Workers Logs) and writes nothing to bb_connect_gate_events. Gate 502s, and routing that takes 1–3 s but stays under the 30 s stall deadline, are therefore invisible in the dataset the debugging doc points to. That may explain the "production trigger … remain unverified" result in the triage above.

    2. Baseline cost of the gate lookup, measured after recovery (16:49–17:06 UTC)

    17-minute probe from the server host, every 10 s, 90 samples per URL. Gate time is TTFB minus TLS. All samples had a ray; there were no errors in this window.

    URL (no cookie) What the gate does Gate time p50 / p90 / max
    https://getbb.app/ no handle lookup (baseline) 0.09 / 0.18 / 0.46 s
    https://salem.getbb.app/ resolveLabel (often cached) → sign-in page 0.22 / 0.30 / 0.42 s
    <machine>--<port>.getbb.app/ (same account) shared-port route → sign-in 0.42 / 0.53 / 0.69 s
    https://zz-nohandle-probe.getbb.app/ one uncached D1 miss → 404 0.41 / 0.55 / 1.26 s
    https://salem.getbb.app/__tunnel (20 samples) resolveLabel({fresh: true}) → 401 0.21–0.36 s

    A second vantage point through MRS shows the same gap: the unknown handle takes 0.51 s p50 after TLS, against 0.16 s for getbb.app/.

    The unknown-handle 404 and the no-credential /__tunnel both do one uncached D1 lookup and nothing else. They cost about 0.2–0.6 s more than getbb.app/. The label cache lives 15 s and the session cache 20 s, and both are per isolate. So a phone that opens a thread after a short pause probably pays two D1 round trips (label + session) before its request reaches the tunnel: about 0.5 s on a good day, several seconds or a 502 on a bad one. That matches "threads slow to open". (Inference from the code and these timings; I can't see your D1 metrics.)

    3. The tunnel dial path shows the same slowness (connect plugin log, 2026-10-18 → 10-28, 120 reconnects)

    • TLS to Cloudflare completes at 58 ms p50 / 158 ms p90.
    • The gate's 101 (upgradeMs) takes 766 ms p50 / 6.0 s p90 / 8.4 s max; 31 of 120 took longer than 3 s.
    • 3 dials timed out after TLS while waiting on the gate (10-20 18:36Z, 10-23 16:46Z, 10-26 10:50Z).

    Today's slow upgrades: 08:26:40Z (7.4 s), 13:42:47Z (6.1 s), 14:52:03Z (5.1 s).

    4. Idle drops, same pattern as #5880 but not specific to ATL

    • 120 tunnel closed (code 1006) in 10 days, 4–20 per day.
    • All of them had transportError: null.
    • 111 of 120 closed while the last heartbeat ack was ≤20 s old, so the tunnel was alive when it dropped.
    • They are spread over 8 colos: FRA 65, TXL 36, CDG 6, VIE 5, DUS/BEG/MUC/AMS 2 each.
    • Nothing local lines up with today's drops: within ±60 s there are only unrelated provider-catalog refresh logs and a few sub-second DB queries. The connect plugin's own logs put origin TTFB for today's 1,158 proxied thread loads at p50 10.6 ms / p99 284 ms.
    Today's drops (UTC): closed ray → new ray
    closed lived hb ack age open WS colo closed ray gap upgrade new ray
    02:37:55 286 min 2.9 s 4 FRA a514ec0828fedc96-FRA 1.7 s 992 ms a5168fb82c418f1a-FRA
    03:06:11 28 min 14.7 s 4 FRA a5168fb82c418f1a-FRA 1.2 s 396 ms a516b9245dd21db8-FRA
    04:20:04 73 min 11.1 s 4 FRA a516b9245dd21db8-FRA 1.3 s 432 ms a517255b59fe68a5-FRA
    05:14:43 9 min 16.1 s 7 FRA a51767cd19864dc0-FRA 1.2 s 287 ms a517756c6a46b580-FRA
    08:26:40 191 min 15.5 s 8 FRA a517756c6a46b580-FRA 8.2 s 7355 ms a5188e99bb39de45-FRA
    13:30:43 303 min 13.4 s 4 FRA a5188e99bb39de45-FRA 1.8 s 766 ms a51a4bfc5e3df4c9-FRA
    13:42:47 12 min 2.4 s 4 FRA a51a4bfc5e3df4c9-FRA 7.1 s 6140 ms a51a5da98f5474d4-FRA
    14:51:38 68 min 3.5 s 7 FRA a51a5da98f5474d4-FRA 1.7 s 1162 ms a51ac281b8c2f4e5-FRA
    14:52:03 0 min 3.4 s 7 FRA a51ac281b8c2f4e5-FRA 5.8 s 5059 ms a51ac31f7fd2d27c-FRA
    15:37:54 45 min 5.1 s 7 FRA a51ac31f7fd2d27c-FRA 1.6 s 757 ms a51b064a6834dbdf-FRA

    Suggested queries on your side

    • Workers Logs for bb connect: request failed around 2026-10-28 16:43–16:48 UTC, ray a51b6861fbc21976-FRA, plus D1 metrics for the connect DB in that window.
    • bb_connect_gate_events WHERE blob4 = 'salem.getbb.app' for slow and tunnel-gap events since 10-18.

    I can rerun the probe, or capture rays for a future spike on request.

    AGENT GENERATED

  6. ymichael commented on Oct 28, 2026

    @ymichael
    Collaborator

    Thanks for the report! deployed a server side fix for this that should help mitigate things. will continue to monitor

  7. ymichael commented on Oct 28, 2026

    @ymichael
    Collaborator

    A bit more information:

    • the periodic drops and instability is something we're addressing by moving off of cloudflare (we have an experiment ongoing right now that hopefully will resolve this in the medium term)
    • the outages today is specifically a scaling issue with usage, that should hopefully be mitigated by the server side fix (I'm seeing error rates dropping already)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    connectpartial-reproperfremote

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions