---
title: OCP Agent 进程启动失败并报错：kind=DEADLINE_EXCEEDED, code=wait_for_read 的原因和解决方法-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于OCP Agent 进程启动失败并报错：kind=DEADLINE_EXCEEDED, code=wait_for_read 的原因和解决方法相关的常见问题和使用技巧，帮助您快速解决OCP Agent 进程启动失败并报错：kind=DEADLINE_EXCEEDED, code=wait_for_read 的原因和解决方法的难题。
image: https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*OSPzQ6GUQF4AAAAAQHAAAAgAeiGDAQ/original
---
[OceanBase AI 数据大会](https://www.oceanbase.com/conference2026 "OceanBase AI 数据大会")

## 体验新一代 AI 数据平台

[立即咨询](https://www.oceanbase.com/contactus) [免费试用 免费试用](https://www.oceanbase.com/free-trial)划线反馈

# OCP Agent 进程启动失败并报错：kind=DEADLINE_EXCEEDED, code=wait_for_read 的原因和解决方法

更新时间：2026-07-08 08:01

适用版本： V2.x、V3.x、V4.x 内容类型：Troubleshoot  

## 问题现象

机器重启后发现个别 OCP Agent 进程（如 `ocp_mgragent` 进程）没有自动启动起来，通过手工命令启动 OCP Agent 或者 OCP Web 界面重装 OCP Agent 也均失败报错。

```shell
"error":"Module=agent, kind=DEADLINE_EXCEEDED, code=wait_for_ready_timeout; "

```

**通过手工命令启动 OCP Agent**

1. 手工命令停止 OCP Agent。

   ```shell
   [root@observer ~]# /home/admin/ocp_agent/bin/ocp_agentctl stop
   {"successful":true,"message":"ok","error":""}

   ```
 2. 手动命令启动 OCP Agent。

   ```shell
   [root@observer ~]# /home/admin/ocp_agent/bin/ocp_agentctl start
   {"successful":false,"message":null,"error":"Module=agent, kind=DEADLINE_EXCEEDED, code=wait_for_ready_timeout; "}

   ```
 3. 显示 OCP agent 进程信息。

   ```shell
   [root@observer log]# ps -ef | grep agent
   root        1680       1  0 10:45 ?        00:00:00 /home/admin/ocp_agent/bin/ocp_agentd -c /home/admin/ocp_agent/conf/agentd.yaml
   root        1766    1680  8 10:45 ?        00:01:43 /home/admin/ocp_agent/bin/ocp_monagent
   root        5094    4904  0 11:06 pts/0    00:00:00 grep agent

   ```
 4. 显示 OBServer 进程信息。

   ```shell
   [root@observer log]# ps -ef | grep observer
   root        5097    4904  0 11:06 pts/0    00:00:00 grep observer

   ```
 5. 显示 OBProxy 进程信息。

   ```shell
   [root@observer log]# ps -ef | grep obproxy
   root        5139    4904  0 11:06 pts/0    00:00:00 grep obproxy

   ```

**OCP Web 界面重装 OCP Agent**

![image01](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/ocp/20241008ocpagent0001.png)

同时 `/home/admin/ocp_agent/log/agentd.log` 中有如下报错日志。

```shell
2024-09-02T11:46:37.56857+08:00 INFO [36732,] caller=agentd/limit_linux.go:20:newLimiter: create service ocp_mgragent resource limit skipped, no limit in config
2024-09-02T11:46:37.5696+08:00 INFO [36732,] caller=agentd/limit_linux.go:31:newLimiter: create service ocp_monagent resource limit done, cpu: 2, memory: 2GiB
2024-09-02T11:46:37.56983+08:00 ERROR [36732,] caller=agentd/watchdog.go:259:cleanupPidPattern: cleanup pid file /home/admin/ocp_agent/run/ocp_mgragent.pid got error fields: error="Module=agent, kind=INTERNAL, code=read_pid_failed; [/home/admin/ocp_agent/run/ocp_mgragent.pid]\ncause:\nstrconv.Atoi: parsing \"\": invalid syntax"
2024-09-02T11:46:37.56992+08:00 INFO [36732,] caller=agentd/watchdog.go:80:Start: starting agentd
2024-09-02T11:46:37.57131+08:00 INFO [36732,] caller=agentd/watchdog.go:93:Start: starting socket listener on '/home/admin/ocp_agent/run/ocp_agentd.36732.sock'
2024-09-02T11:46:37.57156+08:00 INFO [36732,] caller=agentd/watchdog.go:103:Start: starting service 'ocp_mgragent'
2024-09-02T11:46:37.57168+08:00 ERROR [36732,] caller=agentd/watchdog.go:106:Start: start service 'ocp_mgragent' failed: Module=agentd, kind=INTERNAL, code=write_pid_failed; [/home/admin/ocp_agent/run/ocp_mgragent.pid]
cause:
open /home/admin/ocp_agent/run/ocp_mgragent.pid: file exists
2024-09-02T11:46:37.5717+08:00 INFO [36732,] caller=agentd/watchdog.go:103:Start: starting service 'ocp_monagent'
2024-09-02T11:46:37.5718+08:00 INFO [36732,] caller=agentd/service.go:133:startProc: starting service fields: service=ocp_monagent
2024-09-02T11:46:37.57223+08:00 INFO [36732,] caller=agentd/service.go:140:startProc: service process started. pid: 36748 fields: service=ocp_monagent
2024-09-02T11:46:37.57228+08:00 INFO [36732,] caller=agentd/watchdog.go:109:Start: agentd started

```

## 问题原因

正常情况下 `/home/admin/ocp_agent/run/*pid` 文件中记录了对应的 OCP Agent 进程当前正在运行的进程号，但是如果 pid 文件所在的文件系统被写满了，或者出现了文件系统的 `input/output error`，或者人为清空了该 pid 文件，就会出现 pid 文件内容为空的情况。如果 pid 文件内容为空，启动 OCP Agent 进程时，为了避免启动多个同名的 Agent 进程，程序这边做了一层防御保护，直接让启动步骤报错失败。

## 问题的风险及影响

OCP Agent 部分进程无法实现开机自启动或手工重启，如果是 `ocp_mgragent` 进程无法启动，会导致 OBServer/OBProxy 也没法实现开机自启动。

## 影响租户

影响 OceanBase 数据库中的 SYS 租户和 Oracle 租户以及 MySQL 租户。

## 适用版本

OCP Agent V2.x、V3.x、V4.x 版本。

## 解决方法

- 方法一：直接选择重启 OCP Agent，而不是先停下、再启动。

  ```shell
  [root@observer ~]# /home/admin/ocp_agent/bin/ocp_agentctl restart

  ```
 - 方法二：删除 `/home/admin/ocp_agent/run/` 目录下面的大小为 0 的空 pid 文件。

  ```shell
  [root@observer ~]# find . -name "ocp_mgragent.pid" -type f -size 0c | xargs -n 1 rm -f

  ```

  #### 注意

  在删除系统目录下的文件时务必确认清楚再执行带有 `rm -f` 操作的命令。
 - 方法三：向 `/home/admin/ocp_agent/run/` 目录下面的大小为 0 的空 pid 文件中写入一个随机的进程号，比如 123456789。

  ```shell
  [root@observer ~]# echo 123456789 > /home/admin/ocp_agent/run/ocp_mgragent.pid

  ```

  然后重新运行失败的操作即可。

上一篇

[OCP 监控异常](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000006041646)

下一篇

[OCP 创建集群时报 “primary zone F type replica not enough in its region”](https://www.oceanbase.com/knowledge-base/oceanbase-database-20000031547) ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ) 咨询
