[ZBX-15225] Possible file handle leak if vfs.dir.count times out Created: 2018 Nov 28  Updated: 2024 Apr 10  Resolved: 2018 Dec 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 4.0.2, 4.2.0alpha1, 4.2 (plan)
Fix Version/s: 4.0.4rc1, 4.2.0alpha2, 4.2 (plan)

Type: Problem report Priority: Trivial
Reporter: Vladislavs Sokurenko Assignee: Andrejs Sitals (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Team: Team A
Team: Team A
Sprint: Sprint 46, Nov 2018, Sprint 47, Dec 2018
Story Points: 2

 Description   

This ticket is created due to comment

Current suspicion is that handle leak happen when thread is killed by timeout while handle is still open. It should be considered to terminate thread differently as per windows documented better solution:

The TerminateThread and TerminateProcess functions should be used only in extreme circumstances, since they do not allow threads to clean up, do not notify attached DLLs, and do not free the initial stack. In addition, handles to objects owned by the thread are not closed until the process terminates. The following steps provide a better solution:

Create an event object using the CreateEvent function.
Create the threads.
Each thread monitors the event state by calling the WaitForSingleObject function. Use a wait time-out interval of zero.
Each thread terminates its own execution when the event is set to the signaled state (WaitForSingleObject returns WAIT_OBJECT_0).



 Comments   
Comment by Judy [ 2018 Dec 05 ]

Original reporter here: I'm unable to reproduce the issue at this time, due to unrelated issues on the affected server.

The log file for the Zabbix Agent doesn't contain any errors regarding vfs.dir.count in the time period that this issue was observed. Timeout was set to default, and the Zabbix Item was set to update every 2 minutes. The Zabbix agent seemed to "collect handles" at a rate of about 50 per day, with a folder throughput of about 200k files per day. I'm unsure what the peak volume was, probably somewhere between 100k-200k.

Comment by Vladislavs Sokurenko [ 2018 Dec 05 ]

Current suspicion is that you might have "Timeout while waiting for data" error in the log of Zabbix server. This would mean that thread was terminated abnormally, but if you don't have such error then there could be something else.

Comment by Andrejs Sitals (Inactive) [ 2018 Dec 13 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-15225

Comment by Andrejs Sitals (Inactive) [ 2018 Dec 20 ]

Available in versions:

  • pre-4.0.4rc1 r88000
  • pre-4.2.0alpha2 (trunk) r88001
Generated at Fri Apr 19 19:11:55 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.