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

lunarmodules / copas / 30297691869
85%

Build:
DEFAULT BRANCH: master
Ran 27 Jul 2026 07:21PM UTC
Jobs 6
Files 7
Run time 1min
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

27 Jul 2026 07:18PM UTC coverage: 85.029% (-0.3%) from 85.334%
30297691869

push

github

Tieske
fix(io): stale timeout waiters can block a reused socket's real waiter

A socket's read/write/connect timeout resumed the timed-out coroutine
and dropped the socket from the select set, but never cleared that
coroutine's slot in the socket's FIFO wait queue -- that queue was only
ever drained by the normal readiness path, which the timer bypasses.

If the caller kept the socket after a timeout (eg. returned it to a
connection pool) instead of closing it, the stale entry lingered. A
later coroutine waiting on the same socket queued behind it. When the
socket did become ready, the dispatcher popped and resumed the stale
(often already-finished) coroutine instead of the real waiter, dropped
the socket from the select set, and left the real waiter parked
forever with nothing left to wake it. Fixes #208.

Root cause was the FIFO itself: nothing in copas ever legitimately
waits more than one coroutine deep on a socket per direction -- a
socket is only ever driven by one owner at a time. Replaced the FIFO
with a single-slot claim/release pair on the socket set, and moved the
claim to happen before a coroutine yields (inside copas.receive/send/
receivefrom/receivepartial/connect/dohandshake) rather than after, in
the dispatcher. A conflicting second waiter now gets an immediate
"Operation already in progress" back as a normal return value -- same
shape as "timeout" or "closed" -- instead of being silently abandoned
with no way to observe the failure. This also means the dispatcher
never needs to reach into an unrelated coroutine's pending timer: each
coroutine cancels its own via the existing sto_timeout() path, exactly
like every other early-return branch already does.

Adds regression tests covering both directions (duplicate_read_waiter_
errors, duplicate_write_waiter_errors) in tests/tcptimeout.lua.

55 of 74 new or added lines in 1 file covered. (74.32%)

97 existing lines in 5 files now uncovered.

1471 of 1730 relevant lines covered (85.03%)

53656.51 hits per line

Uncovered Changes

Lines Coverage ∆ File
19
79.71
-0.51% src/copas.lua

Coverage Regressions

Lines Coverage ∆ File
92
79.71
-0.51% src/copas.lua
2
94.92
-3.39% src/copas/timer.lua
1
98.15
-1.85% src/copas/future.lua
1
93.62
-1.06% src/copas/lock.lua
1
96.72
-0.82% src/copas/semaphore.lua
Jobs
ID Job ID Ran Files Coverage
1 30297691869.1 27 Jul 2026 07:21PM UTC 7
84.08
GitHub Action Run
2 30297691869.2 27 Jul 2026 07:21PM UTC 7
84.61
GitHub Action Run
3 30297691869.3 27 Jul 2026 07:21PM UTC 7
84.54
GitHub Action Run
4 30297691869.4 27 Jul 2026 07:21PM UTC 7
84.28
GitHub Action Run
5 30297691869.5 27 Jul 2026 07:21PM UTC 7
84.61
GitHub Action Run
6 30297691869.6 27 Jul 2026 07:21PM UTC 7
84.56
GitHub Action Run
Source Files on build 30297691869
  • Tree
  • List 7
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 99f16ca8 on github
  • Prev Build on master (#30213130571)
  • Next Build on master (#30305613508)
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