Commit Graph
4 Commits
Author SHA1 Message Date
EcoosUP 0c4ac7d9a9 fix(concurrency): guard the three shared maps with a mutex
clientPointer, myClientPointer and killChannel are created once at startup and
passed by reference into eleven packages. All of them read and wrote those plain
Go maps from different goroutines, with no synchronisation.

Go does not tolerate that: the runtime kills the process with

    fatal error: concurrent map writes

and a fatal error is not recoverable — a deferred recover() does not catch it.

Measured in production: the process died inside StartClient while five instances
were connecting at once. The orchestrator restarted it within seconds, but every
number was offline in the meantime, and it repeats on any restart that brings up
more than a couple of instances together.

The three maps become safemap.Map[T], a generic wrapper over a RWMutex. It lives
in its own package because MyClient is defined in pkg/whatsmeow/service, and
putting the type there would create an import cycle with the ten packages that
receive the maps.

98 call sites changed across 12 files, with the compiler as the judge: anything
missed is a build error, not a silent bug.

Tests: with -race, a plain map running the same exercise reports DATA RACE and
fails, while safemap.Map passes. Both halves verified.

(cherry picked from commit 3860fa278dc2b901705ffbddbed5cf59d70a85e4)
2026-11-09 12:01:08 -03:00
MayconVM 99b4d78f62 deps: bump whatsmeow to 2026-11-02 (fix 405 client outdated)
whatsmeow was pinned to 2026-06-30 (v0.0.0-20260630180629-b572e5bcb92b),
which predates WhatsApp's minimum client version bump and causes
405 client-outdated connect failures.

- go.mau.fi/whatsmeow -> v0.0.0-20261102152715-54038813c47f
- go.mau.fi/util 0.9.10 -> 0.11.0, x/{crypto,net,sync,sys,text,tools} bumped
- go directive 1.25.0 -> 1.26.0 (upstream minimum), Dockerfile builder
  golang:1.25.0-alpine -> golang:1.26.10-alpine

API adaptations:
- UpdateBlocklist/GetBlocklist now take a dhash argument
- SetStatusMessage takes types.SetStatusInput (text behind mex query)

Store schema upgrades to v16 (companion_meta_nonce, wasa_root_secret_id)
run automatically on container open; verified against a v14 sqlite auth DB.
2026-11-09 11:11:21 -03:00
github-actions[bot] 9337afc47e sync: 0.7.2 from main (6164dced8d3ab8f9bcce9bf333fb4e8663760ff1) 2026-07-03 01:55:33 +00:00
Davidson Gomes 877eef7f07 release: v0.6.1 2026-03-25 12:40:16 -03:00