• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

emqx / esockd
67%
master: 67%

Build:
Build:
LAST BUILD BRANCH: feat/conn-rate-token-refund
DEFAULT BRANCH: master
Repo Added 13 May 2020 07:50AM UTC
Files 22
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH
branch: SELECT
CHANGE BRANCH
x
  • No branch selected
  • fix-rate-limit-pause
  • fix-shared-limiter-overrun
  • fix/do-not-consume-token-for-dead-sockets

25 Aug 2026 04:06PM UTC coverage: 68.867%. First build
601

Pull #228

github

terry-xiaoyu
feat: refund connection-rate token for connections that die before engaging

A connection whose peer FIN/RSTs before any application data was exchanged
consumes a connection-rate token at accept but never engages: under a storm
of dead sockets the limiter bucket can be driven into debt, pausing every
acceptor even though no real connection ever established.

Refund such tokens:
- esockd_limiter:refund/1 returns one token only while the bucket is in debt
  (tokens < 0), so no free tokens are ever created; missing buckets are no-op.
- esockd_transport:upgrade/2 exits the connection process with the
  {shutdown, {pre_establishment, Reason}} marker when an upgrade fun (e.g.
  the TLS handshake) fails with a peer-gone reason (closed/einval/enotconn),
  so TLS dead connections are detected by esockd itself, without any upper
  layer cooperation.
- esockd_connection_sup unwraps the marker: the inner reason is counted in
  shutdown_count as before, and the token is refunded. set_conn_limiter/2
  hands the limiter bucket to the sup (process dictionary, hot-upgrade safe).
- esockd_listener_sup wires the bucket to the connection sup at listener
  start and on set_max_conn_rate reconfiguration.

The emqx side (emqx_connection) produces the same marker for plain-TCP
connections that die before their first bytes (see the paired PR).
Pull Request #228: feat: refund connection-rate token for connections that die before engaging

22 of 22 new or added lines in 4 files covered. (100.0%)

772 of 1121 relevant lines covered (68.87%)

67.03 hits per line

Relevant lines Covered
Build:
Build:
1121 RELEVANT LINES 772 COVERED LINES
67.03 HITS PER LINE
Source Files on fix-rate-limit-pause
  • Tree
  • List 22
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
601 feat: refund connection-rate token for connections that die before engaging A connection whose peer FIN/RSTs before any application data was exchanged consumes a connection-rate token at accept but never engages: under a storm of dead sockets the... Pull #228 25 Aug 2026 04:09PM UTC terry-xiaoyu github
68.87
599 feat: refund connection-rate token for connections that die before engaging A connection whose peer FIN/RSTs before any application data was exchanged consumes a connection-rate token at accept but never engages: under a storm of dead sockets the... Pull #228 25 Aug 2026 03:42PM UTC terry-xiaoyu github
68.96
598 Merge pull request #227 from emqx/fix/do-not-consume-token-for-dead-sockets fix: don't spend connection-rate token on sockets already dead at accept push 25 Aug 2026 03:23PM UTC web-flow github
68.36
596 refactor: merge sock-error counters into get_stats/1 esockd_server:get_stats/1 has no production callers in this tree (only tests), so the per-reason socket-error counters can safely live in its result instead of a separate get_sock_errors/1 quer... Pull #227 25 Aug 2026 10:01AM UTC terry-xiaoyu github
68.36
592 refactor: merge sock-error counters into get_stats/1 esockd_server:get_stats/1 has no production callers in this tree (only tests), so the per-reason socket-error counters can safely live in its result instead of a separate get_sock_errors/1 quer... Pull #227 25 Aug 2026 07:33AM UTC terry-xiaoyu github
68.64
590 refactor: create the discarded stat lazily init_stats({Proto, ListenOn}, accepted) is kept as the synchronous startup barrier against a stale del_stats; discarded is only ever incremented after that barrier, so it can be created lazily on first u... Pull #227 25 Aug 2026 07:09AM UTC terry-xiaoyu github
68.45
588 fix: address PR review comments - esockd_connection_sup: peername failures are returned tagged as {error, {peername, Reason}} so callers can tell 'peer already gone' apart from errors returned by the connection MFA itself - esockd_acceptor: h... Pull #227 25 Aug 2026 06:27AM UTC terry-xiaoyu github
68.48
587 fix/do-not-consume-token-for-dead-sockets Merge d3554a29e into f8a813323 Pull #227 25 Aug 2026 06:00AM UTC web-flow github
68.54
586 refactor: keep all listener counters in one stats table, drop init_stats Review feedback: a second ETS table for socket-error counters is unnecessary, and init_stats is redundant because ets:update_counter/4 already creates missing counters with ... push 25 Aug 2026 05:57AM UTC terry-xiaoyu github
68.81
584 chore: bump vsn to 5.8.14 push 20 Aug 2026 01:50PM UTC terry-xiaoyu github
67.95
See All Builds (560)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc