Skip to content

Hot reload fails when running as a Windows service #9824

@williamb1024

Description

@williamb1024

Bug Report

Describe the bug
When running fluent-bit as a Windows service, calls to http://localhost:2020/api/v2/reload fail with an HTTP status of 500.

To Reproduce

  • Configure fluent-bit as a Windows service
  • Enable HTTP server and hot reload support
  • Request a reload through HTTP

Expected behavior
Fluent-bit would respond with an HTTP status 200 OK and reload its configuration.

Your Environment

  • Version used: 3.2.4

  • Configuration:

    service:
      http_server: true
      http_listen: 0.0.0.0
      http_port: 2020
      hot_reload: true 
    
  • Operating System and version: Windows 11 24H2

  • Filters and plugins: None

Additional context
This issue prevents reloading due to configuration changes. A simple workaround is the restart the fluent-bit service.

The issue appears to be:

ret = GenerateConsoleCtrlEvent(1 /* CTRL_BREAK_EVENT_1 */, 0);

GenerateConsoleCtrlEvent fails in the context of a Windows service. I believe, but have not tested, that the process is started in a detached console mode, which prevents GenerateConsoleCtrlEvent from succeeding.

A simple solution would be to use AllocConsole() when run as a Windows service.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions