Repository navigation
Closed
Description
Duel runs on Linux and macOS, but not on Windows. A maintainer reviewing the pg adoption PR asked whether it does (ged/ruby-pg#771 (comment)), since that's where they're least likely to notice a performance change themselves. Comparing two versions on a Windows runner would catch regressions in Windows-only code paths, such as a C extension's mingw build, which the Linux job can't see.
These are the parts that assume a Unix system:
- Worker control. The runner talks to each worker over a Unix socket (
UNIXServerinlib/duel/runner.rb,UNIXSocketinlib/duel/worker.rb). A TCP socket on localhost, or a pair of pipes asProcessSamplealready uses for JRuby, would work everywhere. - Process groups.
ProcessSample#startspawns withpgroup: true, and#killkills the whole group withProcess.kill("KILL", -pid). Windows hasnew_pgroup:and no group kill, so killing a sample and what it started needs something like a Job Object ortaskkill /T. - Signals.
Resource#end_processstops a resource's server with a signal, then KILL. Windows can't deliver TERM or INT to another process, so a server needs another way to be asked to stop. - Peak memory.
Native::Child.waitcallswait4through Fiddle for a child's peak resident memory. On Windows that'sGetProcessMemoryInfo'sPeakWorkingSetSize, or Duel could leave the peak out. - Available memory.
Memory.availablereads/proc/meminfo, a cgroup limit orvm_stat, so on Windows it says nothing andRunner#fitdoesn't lower the workers.GlobalMemoryStatusExwould give it. - Paths.
Runner.short_tmpfalls back to/tmpwhen the temporary directory's path is too long for a socket. - Instructions. There's no instruction counter, so CPU time would judge alone, as it does on JRuby. That's fine to start with.
The plugins that start servers (postgresql, mysql, redis, memcached) would each need their own look, since they find and stop server programs the Unix way.
Duel's CI should run the tests on windows-latest once it works, and probably on macos-latest too, since macOS isn't tested in CI today either.
Activity
larskanis commentedon Nov 11, 2026
Some related ideas:
I implemented support for UnixSocket on Windows in ruby-3.2 some years ago. It works mostly the same way as on Unix. It has limited path length.
This is similar possible on Windows. A trap can be defined in a Windows subprocess like so:
And then this trap can be triggered by a
kernel32.dllcall like so:PostgreSQL should mostly work the same way as on Unix. It can be controlled by
pg_ctlequally.Measure CPU time on Windows in cycles, and fix what Windows broke
Make the run's lock work on Windows, and the tests that remained
Read Windows's cycles as Floats, which it doesn't allocate
Fix two tests for Windows, and one that left no memory reader
Count macOS's thread's instructions, and run more on macOS and Windows
Run Redis and memcached on Windows over TCP, and fix the plugins there
Fix more of what kept the plugins from running on Windows
Use a memcached for Windows that Dalli can talk to, and fix two tests
Name a program's log by its whole path, and fetch Windows's memcached
Start PostgreSQL with pg_ctl on Windows, and drop JRuby there from CI
Give the MySQL plugin a client of its own, and a tcp: option
Start supporting Windows
6 remaining items
Fix more of what kept the plugins from running on Windows
Use a memcached for Windows that Dalli can talk to, and fix two tests
Name a program's log by its whole path, and fetch Windows's memcached
Start PostgreSQL with pg_ctl on Windows, and drop JRuby there from CI
Give the MySQL plugin a client of its own, and a tcp: option
Require the tests on macOS and Windows, and the plugins' there
sferik commentedon Nov 12, 2026
Windows support is in main as of 443f61a. Duel's tests and every plugin's pass on Windows (CRuby) and macOS in CI now, and those jobs are required. Two things are left, which have issues of their own: running the tests on JRuby on Windows (#4), and a shell command that exits at once hanging ProcessSample on Windows (#5).
Run Redis and memcached on Windows over TCP, and fix the plugins there
Fix more of what kept the plugins from running on Windows
Use a memcached for Windows that Dalli can talk to, and fix two tests
Name a program's log by its whole path, and fetch Windows's memcached
Start PostgreSQL with pg_ctl on Windows, and drop JRuby there from CI
Give the MySQL plugin a client of its own, and a tcp: option
Require the tests on macOS and Windows, and the plugins' there