myxce/src/worker
Rongsong Shen 1c906e955c
fix(worker): job ids print human-readable format via fmt_jobid() (bug-1588)
Extends bug-1588's job.c fix to the remaining raw-%lu jobid logging sites:
8 worker daemon files (xcecd_worker.c, controller_connector.c, uv_ipc.c,
xcecd_worker_utils.c, xcecd_dbus_manager.c, xcecd.c, main.c, xcecd_cgroups.c)
and src/controller/testsuite/test.c (xce_test, heavily used for controller
testing). 99 call sites converted to fmt_jobid()+%s, matching the existing
convention. Non-jobid %lu values (lsn, client id, byte offset) and raw-numeric
identifier/path construction (checkpoint dir, systemd unit name, XCE_JOBID
env var) are deliberately left untouched.

Verified via /xce-build worker and controller (asan, --incremental): both
compile clean with zero warnings tied to the change; worker suite 4/4 OK,
controller suite 4/5 OK (the one failure is the pre-existing bug-1561
overlayfs fdatasync flake, unrelated to this change).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-22 02:42:01 +00:00
..
include feat(component-failover-adoption): fix worker startup ordering, add rejoin retry-on-failure 2026-08-11 06:21:36 +00:00
scripts import worker code 2025-11-24 15:53:31 +08:00
src fix(worker): job ids print human-readable format via fmt_jobid() (bug-1588) 2026-08-22 02:42:01 +00:00
testsuite fix(worker): dbus_workers_update() starves workers after first DONE/EXITED (bug-1589) 2026-08-19 09:48:23 +00:00
CLAUDE.md update documents 2026-08-10 17:51:51 +08:00
meson.build feat(component-failover-adoption): unify worker's dual connect paths into single pipeline 2026-08-11 05:42:48 +00:00
README.md import worker code 2025-11-24 15:53:31 +08:00

Cross-Platform Xcecd Process

This is a cross-platform process manager implementation in C that supports both Linux and Windows platforms. The xcecd provides the following features:

  • Sending status to the remote controller module at port 6789 and receive job requests
  • Maintains a configurable thread pool for request processing
  • Periodically collects and updates system resource status
  • Manages child processes spawned from received commands
  • Caches job status information
  • Uses Unix Domain Sockets for communication between the main process and worker processes

Building

Prerequisites

  • C compiler with C11 support
  • Windows: Visual Studio
  • Linux: GCC and development tools

Build Instructions

On Linux

make

On Windows

nmake

Configuration

The xcecd can be configured through the following parameters in main.c:

  • thread_pool_size: Number of threads in the thread pool (default: 4)
  • resource_update_interval: Interval for updating system resource status in seconds (default: 1)
  • job_status_update_interval: Interval for updating job status in seconds (default: 1)
  • port: Port number to listen on (default: 7869)
  • acct_file_path: Path to the accounting file (default: /tmp/xcecd.acct)
  • log_file_path: Path to the log file (default: /tmp/xcecd.log)
  • domain_sock_path: Path to the Unix Domain Socket file (default: /tmp/xcecd.sock)
  • remote_host: Remote server address (default: lchen02)
  • remote_port: Remote server port (default: 6789)
  • update_interval: Interval for sending status updates to the remote server (default: 1 second)

Usage

Starting the Xcecd

On Windows:

xcecd.exe

On Linux:

./xcecd

Features

  1. Cross-Platform Support

    • Works on both Windows and Linux
    • Abstracts platform-specific implementations
  2. Thread Pool

    • Configurable number of worker threads
    • Efficient request handling
  3. System Monitoring

    • CPU usage monitoring
    • Memory usage monitoring
    • Disk space monitoring
  4. Process Management

    • Spawns child processes for received commands
    • Tracks process status
    • Manages process lifecycle
  5. Network Communication

    • TCP socket-based communication
    • Simple text-based protocol
  6. Unix Domain Socket Communication

    • Uses Unix Domain Sockets for communication between the main process and worker processes

Architecture

The xcecd is composed of several key components:

  • Main Process: Coordinates all components and manages the lifecycle
  • Thread Pool: Handles concurrent request processing
  • System Monitor: Collects and updates system resource information
  • Process Manager: Manages child processes and their status
  • Network Handler: Handles network communication and request receiving
  • Resource Sync: Synchronizes and aggregates resource collection thread, system monitor, and job information

Contributing

Feel free to submit issues and enhancement requests!