[ZBX-19063] Windows Service management signals not properly handled in Zabbix Agent 2 Created: 2021 Feb 26  Updated: 2024 Jul 31  Resolved: 2021 May 12

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 5.0.9, 5.2.5
Fix Version/s: 5.0.12rc1, 5.2.7rc1, 5.4.0rc1, 5.4 (plan)

Type: Problem report Priority: Major
Reporter: Sergey Simonenko (Inactive) Assignee: Eriks Sneiders
Resolution: Fixed Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows


Issue Links:
Duplicate
Team: Team INT
Sprint: Sprint 73 (Feb 2021), Sprint 74 (Mar 2021), Sprint 75 (Apr 2021), Sprint 76 (May 2021)
Story Points: 1

 Description   

In the case the Zabbix 2 Agent receives Windows service management signals other than svc.Stop and svc.Shutdown this is poorly handled by logging ambiguous "unsupported windows service command recieved" message (https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/src/go/cmd/zabbix_agent2/service_windows.go?until=ce3e8eb5eae1bf209cd3ca23795a69a15f48f68f&untilPath=src%2Fgo%2Fcmd%2Fzabbix_agent2%2Fservice_windows.go#461).

This can be reproduced from the PowerShell for example by issuing commands like:

Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
PS C:\Users\Administrator> Suspend-Service -DisplayName "Zabbix Agent 2"
Suspend-Service : Service 'Zabbix Agent 2 (Zabbix Agent 2)' cannot be suspended because the service does not support be
ing suspended or resumed.
At line:1 char:1
+ Suspend-Service -DisplayName "Zabbix Agent 2"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Suspend-Service
 ], ServiceCommandException
 + FullyQualifiedErrorId : CouldNotSuspendServiceNotSupported,Microsoft.PowerShell.Commands.SuspendServiceCommand
Suspend-Service : Service 'Zabbix Agent 2 (Zabbix Agent 2)' cannot be suspended due to the following error: Cannot paus
e Zabbix Agent 2 service on computer '.'.
At line:1 char:1
+ Suspend-Service -DisplayName "Zabbix Agent 2"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Suspend-Service
 ], ServiceCommandException
 + FullyQualifiedErrorId : CouldNotSuspendService,Microsoft.PowerShell.Commands.SuspendServiceCommand

or 

PS C:\Users\Administrator> Start-Service -DisplayName "Zabbix Agent 2"
PS C:\Users\Administrator> Resume-Service -DisplayName "Zabbix Agent 2"
Resume-Service : Service 'Zabbix Agent 2 (Zabbix Agent 2)' cannot be resumed because the service does not support being suspended or resumed.
At line:1 char:1
+ Resume-Service -DisplayName "Zabbix Agent 2"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Resume-Service], ServiceCommandException
 + FullyQualifiedErrorId : CouldNotResumeServiceNotSupported,Microsoft.PowerShell.Commands.ResumeServiceCommand
Resume-Service : Service 'Zabbix Agent 2 (Zabbix Agent 2)' cannot be resumed due to the following error: Cannot resume Zabbix Agent 2 service on computer '.'.
At line:1 char:1
+ Resume-Service -DisplayName "Zabbix Agent 2"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Resume-Service], ServiceCommandException
 + FullyQualifiedErrorId : CouldNotResumeService,Microsoft.PowerShell.Commands.ResumeServiceCommand
 

 
This is accordingly seen in the agent log:

2021/02/26 14:31:18.413739 unsupported windows service command 

 
Below is the link to some example Go code demonstrating how to handle the commands (they may vary, e. g., svc.Interrogate, svc.Pause, svc.Continue):

https://github.com/golang/sys/blob/a50acf3fe073/windows/svc/example/service.go#L30

AFAICS, all versions starting from the implementation of Windows services support are affected.



 Comments   
Comment by Eriks Sneiders [ 2021 May 07 ]

Fixed in versions

Generated at Sat Apr 19 08:11:51 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.