Skip to content

Serhii/windows port - #618

Merged
singaraiona merged 13 commits into
devfrom
serhii/windows-port
Sep 23, 2026
Merged

singaraiona merged 13 commits into
devfrom
serhii/windows-port

Conversation

@ser-vasilich

Copy link
Copy Markdown
Collaborator

Fixes found while porting:

  • format/println/print and the pivot / column-name helpers rendered an i64 through "%ld" + (long), which is 32 bits on Windows: 10^18 printed as -1486618624, and a pivot keyed above 2^31 produced truncated column names — a data defect, not only display. Affects any LLP64 target; regression test added.
  • ray_vm_unmap_file on an interior pointer dropped the whole view (columns carrying a passenger index).
  • ray_vm_alloc_aligned pools were never released.
  • ray_vm_map_fd_ro was a stub, so CSV reads always failed.
  • Winsock errors never reached errno (connection refusal, sends on a dead socket).
  • SO_REUSEADDR let a bind take a port already in use.
  • Symfile paths could key two domains for one file.
  • .sys.info reported 3 of its 5 fields; the banner's CPU line said unknown.

Tests: ;; @requires: posix marks .rfl files whose fixtures or checks need a POSIX shell (reported as SKIP on Windows); C tests use #ifndef RAY_OS_WINDOWS / SKIP with a reason; shell-free ray_test_rm_rf / ray_test_mkdir_p replace system("rm -rf") and "mkdir -p".

Results:

  • Windows: 3854/3918 passed, 64 skipped, 0 failed.
  • Linux (Ubuntu 24.04, gcc 13): 3928/3928 passed.
  • examples/rfl produce identical output on both, and a 67-line parity probe over types, queries, joins, storage, journal and fs verbs diffs clean.
  • bench/bottleneck/windows_vs_linux.md: allocator and engine timings agree within ~1.6x either way; the optimisations from perf(join): skip per-cell key null tests on provably null-free columns #598 and the join PRs engage on Windows with the same effect. bench/alloc and bench/agg_v2 now build on Windows too.

ser-vasilich and others added 12 commits September 22, 2026 14:58
Detect Windows via $(OS) or uname (MSYS2's make hides $(OS)), link
Winsock and a statically linked winpthreads, build with 64-bit off_t
(_FILE_OFFSET_BITS=64) and an 8 MiB stack like a Linux main thread.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Replace the IOCP stub with a readiness-based loop that mirrors the epoll
backend's dispatch order, so the selector state machine is identical on
every platform.  stdin (console or pipe) is not a socket, so RAY_SEL_STDIN
selectors are probed directly and the socket wait is sliced while one is
registered.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- mirror WSAGetLastError()/SO_ERROR into errno for send/recv/connect/
  accept/bind/listen: callers branch on EAGAIN/ECONNREFUSED;
- ipc_send_fn always overwrites errno, so a stale EAGAIN can no longer
  park a frame on a dead socket;
- SO_EXCLUSIVEADDRUSE instead of SO_REUSEADDR (which lets a bind steal
  a port that is in use);
- WSAStartup at load time; sock.h pulls in platform.h;
- verbose IPC capture uses a temp file that works without admin rights;
- the SIGURG out-of-band cancel stays POSIX-only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- ray_vm_unmap_file only unmaps at a view's own base: UnmapViewOfFile
  drops the whole view for an interior pointer, which freed columns that
  carry a passenger index (munmap is a no-op there);
- ray_vm_alloc_aligned returns its own allocation base, so pools are
  really released by ray_vm_free;
- ray_vm_map_fd_ro maps for real (CSV reads always failed with io);
- crash report via SetUnhandledExceptionFilter;
- heap: file-backed spill stays POSIX-only (docs/architecture/memory.md);
- domain: realpath substitute; symfile paths compare case/separator-
  insensitively so one file never gets two domains;
- aof/csr/hnsw: platform handle for fsync, portable ray_mkdir.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- term.h/profile.h include platform.h and a lean <windows.h>;
- term_write for the Windows console, errno.h and core count in the REPL;
- .sys.info reports page-size and total-mem on Windows too;
- KEY_READ no longer collides with <winreg.h>.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- runner: ';; @requires: posix' marks .rfl files whose fixtures or checks
  need a POSIX shell/filesystem; on Windows they are reported as SKIP;
- shell-free ray_test_rm_rf / ray_test_mkdir_p replace system("rm -rf")
  and "mkdir -p" in C tests; test.h maps the few POSIX helpers tests use;
- tests of POSIX-only behaviour (setrlimit, ENOTDIR, read-only dirs,
  AF_UNIX, file spill, Winsock send buffering) skip with the reason;
- fixture fixes that were latent on any platform: binary-mode CSV
  fixtures, a per-test AOF dir, journal closed before the crash rename.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
No console font Windows ships has U+2023 (checked Consolas, Cascadia Mono,
Lucida Console, Courier New) and the classic console does no font fallback,
so the prompt rendered as '?'.  Use the nearest filled triangle they all do
have, U+25BA, which is also three UTF-8 bytes.

The banner's CPU line said 'unknown': read ProcessorNameString instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…check

alloc and agg_v2 read peak RSS through getrusage; use
GetProcessMemoryInfo there.  windows_vs_linux.md records the numbers the
port was checked against.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Interpolation (format/println), print and the pivot / column-name helpers
formatted an i64 with "%ld" and a (long) cast.  long is 64-bit on LP64 and
32-bit on Windows, so there 10^18 printed as -1486618624 and a pivot keyed
on values above 2^31 produced truncated column NAMES — a data defect, not
only a display one.  Use PRId64 throughout; regression test included.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…plicing

The banner was spliced from string literals and the RAYFORCE_VERSION /
RAYFORCE_GIT_COMMIT macros inside #ifdef arms; without the -D values a
static analyser reads the literal followed by the bare macro name as two
adjacent tokens and reports a syntax error.  Format it with one snprintf
at install time (the handler itself still never formats), with the
macros defaulting to empty strings.  Output unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 23, 2026

Copy link
Copy Markdown

Rayforce targeted audit passed

The required Rayforce audit gate passed on the latest run.

Workflow run: https://github.com/RayforceDB/rayforce/actions/runs/35867310033

`til` is eager, so counting a three-billion-element range built a 24 GB
vector for no extra coverage — the neighbouring literals already cross
2^31, 2^32 and 2^63.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@singaraiona
singaraiona merged commit 4eb3b10 into dev Sep 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants