Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demon start failed in windows platform #19

Closed
kvii opened this issue Jan 16, 2022 · 6 comments · Fixed by #24
Closed

demon start failed in windows platform #19

kvii opened this issue Jan 16, 2022 · 6 comments · Fixed by #24
Labels
bug Something isn't working

Comments

@kvii
Copy link
Contributor

kvii commented Jan 16, 2022

windows 平台 daemon 命令运行报错

windows 平台下 mg daemon start 运行报错。
我觉得应该是 mg daemon start 没有调用 s.Run 方法的原因。

复现步骤

  1. windows 平台下执行 make 打包应用。
  2. 执行 ./mg daemon install 注册服务。
  3. 执行 ./mg daemon start 运行服务。
  4. 一段时间后控制台报错 midgard: failed to start, err: The service did not respond to the start or control request in a timely fashion.

解释

个人猜测,windows 平台下服务注册与启动流程应该是这样的:

  1. Install 方法将 path/to/your/service run 注册到系统服务中。
  2. Start 方法通知系统后台执行 path/to/your/service run 命令。
  3. 命令被系统调用后。调用 Run 方法通知系统与 Handler 交互。
  4. Handler 通过 Execute 方法与系统交互。在其他协程中运行业务逻辑。

而当前的 mg daemon run 命令直接在当前协程运行了业务逻辑,并且没使用 s.Run 方法。
导致 Handler 无法与系统进行交互。最终超时报错。

@changkun
Copy link
Owner

应该是个 bug,对windows平台的经验不多,如果可以,直接使用 mg daemon run 来运行服务。

@changkun changkun added the bug Something isn't working label Jan 16, 2022
@kvii
Copy link
Contributor Author

kvii commented Jan 16, 2022

应该是个 bug,对windows平台的经验不多,如果可以,直接使用 mg daemon run 来运行服务。

直接运行 mg daemon run 会占用当前 terminal。所以不能用这条命令运行一个后台服务。

@changkun
Copy link
Owner

可以多开一个 terminal,或者使用 tmux 创建多个子窗口

@kvii kvii closed this as not planned Won't fix, can't repro, duplicate, stale Sep 8, 2022
@changkun
Copy link
Owner

changkun commented Sep 8, 2022

Is the issue resolved?

@kvii
Copy link
Contributor Author

kvii commented Sep 8, 2022

No. It's just I don't want it to open.
You can reopen it if you want.

Consider to use service?
I have used this package for my business code.

@changkun
Copy link
Owner

changkun commented Sep 8, 2022

I think this is an essential issue that exists in the current codebase. Therefore, we should keep it open. But I am currently don't have any bandwidths to take a deep look. Hopefully, I might find some time in early Oct. I would be appreciated and be willing to take a look if you send a PR to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants