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 can't stop without an error. #1352

Closed
Techni-P opened this issue Nov 30, 2023 · 2 comments
Closed

Windows service can't stop without an error. #1352

Techni-P opened this issue Nov 30, 2023 · 2 comments
Milestone

Comments

@Techni-P
Copy link

With windows_exporter 0.24.0 we have again the same Issue like:
#1258

When I try to stop the windows_exporter service (v0.24.0), it always returns an error:
image
and the Process is still running in the Background.

DiniFarb added a commit to DiniFarb/windows_exporter that referenced this issue Dec 28, 2023
Signed-off-by: Dinifarb <andreas.vogt89@bluewin.ch>
DiniFarb added a commit to DiniFarb/windows_exporter that referenced this issue Dec 29, 2023
…top error every time

Signed-off-by: Dinifarb <andreas.vogt89@bluewin.ch>
@DiniFarb
Copy link
Contributor

DiniFarb commented Dec 29, 2023

I have looked into that again and I was able to reproduce it with v0.24.0. But the stop error was not thrown every time just here and there. So I was thinking again of what I mentioned in #1258. Maybe sometimes the main thread/goroutine finishes before the subroutine which does the communication to the windows API has completed. To proof my point I have added a delay after the stop signal is sent to the main thread in the Execute func here: https://github.com/DiniFarb/windows_exporter/blob/aebd6df1e21760d887dd26041a402f14c5d79c33/pkg/initiate/initiate.go#L23-L46

with this delay of 100ms the stop error is thrown each time the service is stopped.

I think the problem lies in that the svc.Run func is not the one which blocks the main routine as it is in the example of go here: https://github.com/golang/sys/blob/master/windows/svc/example/main.go

I am running out of time right now but I can dig into this further in a few days .. well next year ^^

DiniFarb added a commit to DiniFarb/windows_exporter that referenced this issue Dec 30, 2023
… in main()

Signed-off-by: Dinifarb <andreas.vogt89@bluewin.ch>
DiniFarb added a commit to DiniFarb/windows_exporter that referenced this issue Jan 7, 2024
Signed-off-by: Dinifarb <andreas.vogt89@bluewin.ch>
DiniFarb added a commit to DiniFarb/windows_exporter that referenced this issue Jan 8, 2024
Signed-off-by: Dinifarb <andreas.vogt89@bluewin.ch>
@jkroepke
Copy link
Member

jkroepke commented Jan 9, 2024

@DiniFarb this issue can be close, right?

@jkroepke jkroepke added this to the v0.25.0 milestone Jan 9, 2024
@breed808 breed808 closed this as completed Jan 9, 2024
jrvaldes pushed a commit to jrvaldes/openshift-prometheus-community-windows_exporter that referenced this issue May 14, 2024
Signed-off-by: Dinifarb <andreas.vogt89@bluewin.ch>
anubhavg-icpl pushed a commit to anubhavg-icpl/windows_exporter that referenced this issue Sep 22, 2024
Signed-off-by: Dinifarb <andreas.vogt89@bluewin.ch>
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

4 participants