Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-23744

Zabbix agent (windows) does not release process handles

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 5.0.38, 6.0.23, 6.4.8, 7.0.0alpha7
    • Agent (G)
    • None
    • Windows Server 2022 21H2 Build 20348.2113;
      Zabbix Agent;
      Zabbix Agent 2;

      The Zabbix agent can capture and hold the process handles of applications (.net) that terminate due to an unhandled exception.
      This most often happens if during zabbix agent startup an application process (.net) terminates due to an unhandled exception.
      Processes whose handles are captured by the agent cannot be terminated by the operating system, so you must stop the zabbix agent to terminate the processes.

      Steps to reproduce:

      1. Start the agent.
      2. For example, use powershell to run an application in a loop that throws an unhandled exception right after startup (the application is written in C# (.net core)).
      3. Restart the agent process.
      4. Stop the task started in step 2.

      The application project files from the example:

      Program.cs

      throw new InvalidOperationException(); 

      DebugConsole2.csproj

      <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
          <OutputType>Exe</OutputType>
          <TargetFramework>net6.0</TargetFramework>    
          <ImplicitUsings>enable</ImplicitUsings>    
          <Nullable>enable</Nullable>
        </PropertyGroup>
      </Project> 

      Example powershell script from step 2:

      while($true) { Start-Process -FilePath "C:\Temp\net6.0\DebugConsole2.exe"; Start-Sleep -Milliseconds 50 } 

      Result:

      The DebugConsole2.exe process was terminated due to an unhandled exception, but it continues to remain in the Suspended state on the system.
      The DebugConsole2.exe process cannot be terminated because the zabbix agent holds the process handles.
      The zabbix agent releases the DebugConsole2.exe process handles only after the agent process is stopped.

      **

      Expected:
      Zabbix agent does not prevent the process from terminating due to an unhandled exception.

            zabbix.dev Zabbix Development Team
            firerain Dmitry
            Votes:
            8 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: