waha icon indicating copy to clipboard operation
waha copied to clipboard

[GOWS] - Session silently stops sending webhook events after <stream:error> (media ack); status stays WORKING until manual restart

Open mateusangelo opened this issue 4 months ago • 14 comments

WAHA Version: GOWS (2026.6.2 CORE) Engine: GOWS

We are experiencing a failure where a session silently stops emitting webhook events while its status remains WORKING. The webhook endpoint is healthy the whole time (all logged POSTs return HTTP 200). The only workaround is manually restarting the session, after which all backlogged events are delivered at once.

This looks related to #1456, but I have log evidence pointing to a specific trigger: a stream:error with a media ack that keeps repeating with the same ack id during the entire dead window.

Logs

The failure sequence (times in UTC, 2026-07-09): Normal operation — webhooks flowing, last delivery: 14:47:48 Sending POST... 14:47:48 POST request was sent with status code: 200

Seconds later, stream terminated by server with a media ack stream error: 14:47:48 [Session/6191575640/Client] Received stream end frame 14:47:48 [Session/6191575640/Client] Unknown stream error: stream:error</stream:error> 14:47:48 [Session/6191575640/Client/Socket] Error reading from websocket: failed to get reader: failed to read frame header: EOF 14:47:49 [Session/6191575640/Client] Successfully authenticated

From this point: zero Sending POST entries for 4h24m (14:47 → 19:11). Session status stays WORKING. The exact same stream error repeats every ~50 minutes, always with the same ack id 3EB03E5D43E6BE64A6DAEC:

15:37:49 Unknown stream error: stream:error<ack ... id="3EB03E5D43E6BE64A6DAEC" type="media"/></stream:error> + EOF + Successfully authenticated 16:27:51 (same error, same ack id) 17:17:52 (same error, same ack id) 18:07:54 (same error, same ack id) 18:57:55 (same error, same ack id)

It looks like a pending media ack/receipt gets stuck and poisons the connection loop: gows keeps re-sending it, the server keeps closing the stream, and no events reach the webhook dispatcher anymore.

Manual restart — webhooks resume instantly and the backlog floods in: 19:11:42 Stopping session... 19:11:43 Session has been started. 19:11:44 Sending POST... 19:11:44 POST request was sent with status code: 200 (dozens of backlogged events delivered in the next seconds)

Confirmed from the webhook receiver side: last event received 14:46 UTC, nothing until the 19:11 restart, then a burst of backlogged events.

Possibly related evidence from the same logs (2026-07-07)

13,563x [gRPC] Dropping event for slow listener , session 6191575640 — one listener dropped 10,291 events continuously from 13:01 to 20:39 UTC (7.5h of lost webhooks while the session stayed WORKING). During that window, a Go panic in event handling:

15:45:14 [Session/6191575640/Client/Storage] Panic happened in handle event: runtime error: invalid memory address or nil pointer dereference. Stack: goroutine 91944251 [running]: ...

patron:PLUS

mateusangelo avatar Jul 09 '26 20:07 mateusangelo

Let's try dev image 🤞🏻

Make sure to select the engine via the environment variable - WHATSAPP_DEFAULT_ENGINE=GOWS:

  • devlikeapro/waha-plus:dev
  • devlikeapro/waha-plus:dev-chrome
  • devlikeapro/waha-plus:dev-arm

patron:PRO

devlikepro avatar Jul 10 '26 06:07 devlikepro

@devlikepro Tested on GOWS 2026.7.1 PLUS (dev build) — issue still present As requested, I upgraded to the dev build 2026.7.1 PLUS and started a fresh session to test. Unfortunately the fix didn't work — the same failure signature appears in the logs. Fresh session 1938923218, started 2026-07-14 01:20 UTC. Within ~1h15m the stuck media-ack pattern showed up:

02:34:03 [Session/1938923218/Client] Received stream end frame 02:34:03 [Session/1938923218/Client] Unknown stream error: stream:error</stream:error> 02:34:03 [Session/1938923218/Client/Socket] Error reading from websocket: failed to get reader: failed to read frame header: EOF

03:24:06 (same stream error, SAME ack id 3EB0A7A387BBAA89B90BE8)

This is impact many clients of my services :(

patron:PLUS

mateusangelo avatar Jul 14 '26 03:07 mateusangelo

2026.7.1 - GOWS - session silently stops sending webhook events after <stream:error> (media ack); status stayed WORKING until a manual restart - #2151

patron:PRO

devlikepro avatar Jul 15 '26 13:07 devlikepro

Did you get to test the new version? @mateusangelo

patron:PRO

bergpinheiro avatar Jul 16 '26 11:07 bergpinheiro

@bergpinheiro Apparently, a tweak in whatsmeow combined with the fix in WAHA solved the issue. I spun up a server, I'm monitoring it now, and it looks good so far. It seems this whatsmeow fix wasn't in the version I tested before. I'll give a final verdict by the end of the day, but for now, it's looking positive. Thanks a lot!

patron:PLUS

mateusangelo avatar Jul 16 '26 12:07 mateusangelo

@devlikepro e @bergpinheiro I analyzed the waha code and the daily logs from several accounts experiencing this issue that I moved to the updated server:

After 2026.7.1: the ~50-min media-ack stream error still loops — root cause looks like an unhandled stanza that never gets acked Setup: WAHA Plus 2026.7.1 (GOWS, gows v1.0.43 / whatsmeow b4013837 — verified in the binary), ~40 sessions, 28h of logs analyzed after upgrading.

Confirmed fixed 👍: the permanent silent webhook stop is gone. Every kill now reconnects in ~1s and webhooks resume. Thanks!

Still happening: stream:error</stream:error> every exactly ~3001s per session. In 28h: 331 poison-signature warnings, 606 kills, 41 sessions, 37 distinct ids — new ids enter the loop daily, the same id hits up to 8 sessions (it's a received status), and ids come in both 3EB0… (Baileys/whatsmeow) and 32-hex (official client) formats.

Why the decideAck plain-ack doesn't clear it: the poisoned ids have zero processing logs — no parse errors, no decrypt errors, nothing (0 hits in 28h). The item never reaches decryptMessages(), so no receipt/ack path ever runs for it.

Worst practical effect — head-of-line blocking. Poisoned sessions stop receiving for hours (status stays WORKING), then get flushed in bursts after some reconnects:

12:14 kill → silence 13:04 kill → silence 13:54 kill → silence 14:44 kill → BURST: 270 webhooks in 59s (another session: 1,738 in 15 min) Messages aren't lost — they're delivered 2–5 hours late, held behind the unacked item in the offline queue.

Root-cause hypothesis (fits everything): in whatsmeow, sendAck builds class = node.Tag and copies type only for non-message stanzas — so is the ack for a stanza whose tag is literally status. But cli.nodeHandlers has no status entry, and unhandled stanzas are dropped silently at DEBUG ("Didn't handle WhatsApp node %s") and never acked. If the server now delivers status stories as a standalone stanza, whatsmeow drops it, the server keeps it pending, kills the stream every ~50 min embedding the ack it expects, and blocks the queue behind it.

Easy to confirm: run one affected session at debug level through a cycle and grep Didn't handle WhatsApp node.

Proposed minimal fix:

// client.go — nodeHandlers "status": cli.handleStatusStanza,

func (cli *Client) handleStatusStanza(ctx context.Context, node *waBinary.Node) { defer cli.maybeDeferredAck(ctx, node)() // optionally parse/dispatch as a story event later } The generic sendAck already emits exactly what the server asks for. Also suggest raising the unhandled-node log to WARN — this stayed invisible for weeks because it's DEBUG-only.

Secondary (gows aaf6025): the slow-listener poison-pill counter resets on any successful send, so bursty congestion ("297 drops → 1 success → 200 drops…") never reaches 1000 consecutive: ~193k events dropped in 28h with only 19 pill triggers. A cumulative/time-windowed threshold would catch it.

Happy to test a patched build or share full logs privately.

patron:PLUS

mateusangelo avatar Jul 17 '26 08:07 mateusangelo

@bergpinheiro e @devlikepro It didn't completely resolve the issue. I still had a few cases today, even with people using the final 2026.7.1 version. Is there any specific information I can send you

patron:PLUS

mateusangelo avatar Jul 17 '26 23:07 mateusangelo

Can you explain which cases these were and provide their respective logs?

patron:PRO

bergpinheiro avatar Jul 17 '26 23:07 bergpinheiro

@bergpinheiro posso te enviar no discord ou tem algum email ?

patron:PLUS

mateusangelo avatar Jul 19 '26 20:07 mateusangelo

English


@bergpinheiro can I send it to you on discord or do you have an email ?

github-actions[bot] avatar Jul 19 '26 20:07 github-actions[bot]

@mateusangelo discord;

patron:PRO

bergpinheiro avatar Jul 20 '26 18:07 bergpinheiro

@mateusangelo I believe this issue was resolved in version 2026.7.2! Can you confirm?

patron:PRO

bergpinheiro avatar Jul 30 '26 02:07 bergpinheiro

This issue is still happening.

It occurred again on July 31, 2026, while using GOWS version 2026.7.2. During the failure, the session remained in a working state.

The following error was logged:

13 INTERNAL: Internal server error: runtime error: invalid memory address or nil pointer dereference

matheusrramos97 avatar Jul 31 '26 15:07 matheusrramos97

@bergpinheiro for me, it is ok now. Thanks :)

patron:PLUS

mateusangelo avatar Aug 04 '26 05:08 mateusangelo