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

HTTP service should not abort the process on error #843

Open
rfratto opened this issue May 14, 2024 · 3 comments
Open

HTTP service should not abort the process on error #843

rfratto opened this issue May 14, 2024 · 3 comments

Comments

@rfratto
Copy link
Member

rfratto commented May 14, 2024

This code aborts the process on error:

// There is no recovering from failing to listen on the port.
level.Error(s.log).Log("msg", fmt.Sprintf("failed to listen on %s", s.opts.HTTPListenAddr), "err", err)
os.Exit(1)

While it's true that failing to start a service should eventually terminate the process, allowing services to abort the process directly can bypass cleanup logic scheduled by other running services or components.

To prevent future bugs, services should not directly terminate the Alloy process. Instead, the Alloy runtime should bubble up a service exiting prematurely so that Alloy gracefully shuts down when a service error is encountered.

@csh0101
Copy link

csh0101 commented May 28, 2024

I think to implement it , maybe need to improve compoents controller 's runtime.. maybe we need to have a topology for our .. in the other way, do think it is proper way to extract http service to a standalone service?.. decouple with alloy main process.

@rfratto
Copy link
Member Author

rfratto commented Jun 14, 2024

IMO this is tangentially related to #266, where the lifecycle of services are identical to the lifecycle of components This leads to two issues:

  1. The controller shutdown process doesn't consider whether services need to outlive any running component (Flow: services terminate too early during process shutdown #266), and
  2. errors in running a service are ignored, leading service implementations to need to resort to less ideal changes like os.Exit(1).

in the other way, do think it is proper way to extract http service to a standalone service?.. decouple with alloy main process.

Could you explain what this would mean a little more?

@csh0101
Copy link

csh0101 commented Jun 15, 2024

IMO this is tangentially related to #266, where the lifecycle of services are identical to the lifecycle of components This leads to two issues:IMO 这与 #266 密切相关,其中服务的生命周期与组件的生命周期相同,这导致了两个问题:

  1. The controller shutdown process doesn't consider whether services need to outlive any running component (Flow: services terminate too early during process shutdown #266), and控制器关闭过程不考虑服务是否需要超过任何正在运行的组件 ( Flow: services terminate too early during process shutdown #266 ),并且
  2. errors in running a service are ignored, leading service implementations to need to resort to less ideal changes like os.Exit(1).运行服务时的错误将被忽略,导致服务实现需要求助于不太理想的更改,例如 os.Exit(1)

in the other way, do think it is proper way to extract http service to a standalone service?.. decouple with alloy main process.另一方面,确实认为这是将 HTTP 服务提取到独立服务的正确方法?..与合金主工艺脱钩。

Could you explain what this would mean a little more?您能解释一下这意味着什么吗?

hello. I'm sorry for this mistake . at the time i see this issue, i have too little knowledge about alloy service model to understand this. but when i see the more alloy code ,and I know the service what's means in alloy ..

and you're correct. when i see code, I found that the service is component in the alloy graph ? (maybe it called flow mode -- from grafana agent..) I will go to see the related issue to help me understand this problem deeply.

thanks

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

No branches or pull requests

2 participants