Skip to content

[Bug][v0.3.24]: openviking-server segfaults when started in a child process and hit by health/summary checks. Might relate to stdout/stderr redirection. #2489

@xiaobin83

Description

@xiaobin83

Bug Description

OpenViking sever segfaults when execute the scripts attached.

First execute spawn-server.sh below to start the server,

#!/bin/bash
# 以子进程方式启动 openviking-server,模拟 app 的启动行为
# 用法:
#   bash scripts/spawn-server.sh
#   . scripts/spawn-server.sh  (保持变量在当前 shell)

set -m  # 启用 job control,后台进程获得独立进程组

VENV_PYTHON="/Users/xxxx/Library/Application Support/com.openviking.desktop/python/bin/python3"
VENV_ROOT=$(dirname "$(dirname "$VENV_PYTHON")")
VENV_BIN="$VENV_ROOT/bin"
SERVER_CMD="$VENV_BIN/openviking-server"
CONFIG="$HOME/.openviking/ov.conf"
PORT=1934

export VIRTUAL_ENV="$VENV_ROOT"
export PATH="$VENV_BIN:$PATH"

"$SERVER_CMD" \
  --host 127.0.0.1 \
  --port $PORT \
  --config "$CONFIG" &

Then execute health-check.sh below,

#!/bin/bash

BASE_URL="http://127.0.0.1:1934"
AUTH="Authorization: Bearer test"
ACCOUNT="X-OpenViking-Account: default"
USER="X-OpenViking-User: default"

echo "=== Health Check ==="
curl -v -X GET \
  -H "$AUTH" \
  -H "$ACCOUNT" \
  -H "$USER" \
  "$BASE_URL/health"

echo ""
echo "=== Dashboard Summary ==="
curl -v -X GET \
  -H "$AUTH" \
  -H "$ACCOUNT" \
  -H "$USER" \
  "$BASE_URL/api/v1/console/dashboard/summary"

And the server segfaults.


When I change the command of start to redirect stdout/stderr to a file. it wont crash.

"$SERVER_CMD" \
  --host 127.0.0.1 \
  --port $PORT \
  --config "$CONFIG" > server.log 2>&1 &

ov.conf

{
  "server": {
    "host": "127.0.0.1",
    "port": 1934,
    "root_api_key": "test",
    "cors_origins": [
      "*"
    ]
  },
  "storage": {
    "workspace": "/Users/xxxx/.openviking/data",
    "vectordb": {
      "name": "context",
      "backend": "local"
    },
    "agfs": {
      "backend": "local"
    }
  },
  "embedding": {
    "max_concurrent": 10,
    "max_retries": 3,
    "dense": {
      "provider": "local",
      "model": "bge-small-zh-v1.5-f16",
      "model_path": "/Users/xxxx/Workspace/openviking/openviking-desktop/src-tauri/Resources/models/bge-small-zh-v1.5-f16.gguf"
    },
    "circuit_breaker": {
      "failure_threshold": 5,
      "reset_timeout": 60,
      "max_reset_timeout": 600
    }
  },
  "vlm": {
    "max_retries": 3,
    "max_concurrent": 100,
    "timeout": 60,
    "thinking": false,
    "stream": false,
    "provider": "deepseek",
    "api_key": "sk-vo50",
    "model": "deepseek-v4-flash",
    "api_base": "https://api.deepseek.com",
    "temperature": 0.1
  },
  "encryption": {
    "enabled": false
  },
  "log": {
    "level": "INFO",
    "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
    "output": "stdout",
    "rotation": true,
    "rotation_days": 3,
    "rotation_interval": "midnight"
  },
  "feishu": {
    "domain": "https://open.feishu.cn",
    "max_rows_per_sheet": 1000,
    "max_records_per_table": 1000
  }
}

Steps to Reproduce

Check the description.

Expected Behavior

After the monitor starts a openviking-server as a child process, the monitor should be able to watch the status of the server.

Actual Behavior

The server crashes when the monitor tries to access health and summary.

Minimal Reproducible Example

Error Logs

health-check log

=== Health Check ===
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying 127.0.0.1:1934...
* Connected to 127.0.0.1 (127.0.0.1) port 1934
> GET /health HTTP/1.1
> Host: 127.0.0.1:1934
> User-Agent: curl/8.7.1
> Accept: */*
> Authorization: Bearer test
> X-OpenViking-Account: default
> X-OpenViking-User: default
> 
* Request completely sent off
2026-06-07 12:21:16,059 - uvicorn.access - INFO - 127.0.0.1:52994 - "GET /health HTTP/1.1" 200
< HTTP/1.1 200 OK
< date: Sun, 07 Jun 2026 04:21:15 GMT
< server: uvicorn
< content-length: 149
< content-type: application/json
< x-process-time: 0.007102667004801333
< 
* Connection #0 to host 127.0.0.1 left intact
{"status":"ok","healthy":true,"version":"0.3.24","auth_mode":"api_key","account_id":"default","user_id":"default","agent_id":"default","role":"root"}
=== Dashboard Summary ===
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying 127.0.0.1:1934...
* Connected to 127.0.0.1 (127.0.0.1) port 1934
> GET /api/v1/console/dashboard/summary HTTP/1.1
> Host: 127.0.0.1:1934
> User-Agent: curl/8.7.1
> Accept: */*
> Authorization: Bearer test
> X-OpenViking-Account: default
> X-OpenViking-User: default
> 
* Request completely sent off
* Empty reply from server
* Closing connection
curl: (52) Empty reply from server

OpenViking Version

0.3.24

Python Version

3.13.13

Operating System

macOS

Model Backend

None

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions