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

Windows service fails to start on OS (re)boot #6076

Open
weiss opened this issue Jun 11, 2022 · 1 comment
Open

Windows service fails to start on OS (re)boot #6076

weiss opened this issue Jun 11, 2022 · 1 comment
Assignees
Labels
bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community team:PS Assigned to OTP team PS team:VM Assigned to OTP team VM

Comments

@weiss
Copy link
Contributor

weiss commented Jun 11, 2022

Describe the bug
SCM services installed using erlsrv fail to start on Windows (re)boot, at least on Windows 10, 11, and Windows Server 2019 (earlier Windows versions don't seem to be affected). An ErlSrv error is reported to the Windows event log: Could not get registry keys for erlang service. Seems erlsrv writes a few things into the registry and for some reason fails to read them when called early during boot. Manually starting the service after reboot works, and setting the startup type to "Automatic (Delayed Start)" works around the issue.

To Reproduce
On a non-ancient Windows system with a non-ancient Erlang/OTP version installed:

  • Download and extract my minimal example project.
  • Change into the extracted directory and build an OTP release in an erl shell:
up_to_date = make:all(),
{ok, Conf} = file:consult("reltool.config"),
{ok, Spec} = reltool:get_target_spec(Conf),
ok = reltool:eval_target_spec(Spec, code:root_dir(), "rel"),
halt().
  • Change into the same directory within a cmd shell with administrator privileges, and install/start the SCM service:
rel\erts-<version>\bin\erlsrv.exe add example_1.0.0 -sname example
rel\erts-<version>\bin\erlsrv.exe start example_1.0.0
  • Check that the service is running in the Service Control Manager.
  • Reboot Windows, and see how the service is not running in the Service Control Manager.

Expected behavior
The service starts up on (re)boot.

Affected versions
I've reproduced the problem with Erlang/OTP 25.0.1.

Additional context
This issue has been reported to several projects over the past few years, e.g.:

Therefore, I'd assume this isn't a new problem. The usual workaround seems to be to use the delayed startup type as mentioned above (e.g., emqx/emqx-rel@28b1a00 or processone/eturnal@9b452ea).

@weiss weiss added the bug Issue is reported as a bug label Jun 11, 2022
@rickard-green rickard-green added team:VM Assigned to OTP team VM team:PS Assigned to OTP team PS labels Jun 13, 2022
@sverker
Copy link
Contributor

sverker commented Jun 16, 2022

This is not prioritized for us right now. PR is welcome. Help Wanted label set.

@sverker sverker added the help wanted Issue not worked on by OTP; help wanted from the community label Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community team:PS Assigned to OTP team PS team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

3 participants