caxanga334/cvreduxmodified

Potential Memory Leak

Closed this issue · 3 comments

Describe the bug
Too many handles open (potential memory leak).

  • customvotes.cfg
// Custom Votes Redux
// By: ReFlexPoison
//
// Thank you for downloading Custom Votes Redux. If you like my work and want to help out send me a donation. https://forums.alliedmods.net/member.php?u=149090
//
// For full plugin documentation, go to: https://forums.alliedmods.net/showthread.php?p=2097623
//
// How to edit this file: (Not all values will effect every type of vote. Ex: "currentmap" won't change anything in "players" type votes)
//
// "Custom Votes"										<--	Leave this alone
// {													<--	Add all votes after first bracket (Leave this alone)
// 		"Say something funny!"							<--	Name of vote
// 		{
// 			"type"					"list"				<--	Type of vote (Valid types: players, map, list, simple)
//															players - Populates the vote with a list of the online players
//															map - Populates the vote with a list of maps from a specific map list
//															list - Populates the vote with a custom list of choices
//															simple - Doesn't populate the vote with anything
//
//			"vote"					"1"					<-- Determine if a vote is called to determine the result of the selection, or if each selection is chosen  manually by the players
//			"cvar"					"sm_cvar"			<-- Control variable being changed
//
//			"options"									<-- These are your list options
//			{
//				"lol"		"LOL"						<-- Option name: lol | Option result: LOL
//				"rofl"		"ROFL"						<-- Option name: rofl | Option result: ROFL
//			}
//
//			"override"				"sm_lol"			<--	Admin override (Use this with admin_overrides.cfg to prohibit access from specific players)
//			"immunity"				"0"					<--	Admins with equal or higher immunity are removed from the vote
//
//			"delay"					"60"				<-- Delay in seconds before players can cast a selecting after the map has changed
//			"cooldown"				"5"					<-- Delay in seconds before players can vote again after casting a selection
//			"team"					"0"					<-- Restricts players to only casting selections on team members
//			"bots"					"0"					<-- Allows/disallows casting selections on bots
//			"ratio"					"0.6"				<-- Ratio of players required to cast a selection
//			"multiple"				"0"					<-- Allow/disallow players from casting a selection on more than one option
//			"minimum"				"4"					<-- Minimum votes required for the vote to pass (Overrides ratio)
//			"maxcalls"				"3"								<-- Maximum times a player can cast a selection (0 = No Limit)
//			"maxpasses"				"3"								<-- Maximum amount of times the vote can be passed
//			"command"				"sm_csay {OPTION_RESULT}"		<-- Command(s) ran when a vote is passed
//
//			"start_notify"			"Started vote.					<-- Printed to everyone's chat when a player starts a vote
//			"call_notify"			"Voted for {OPTION_NAME}.		<-- Printed to everyone's chat when a player casts a selection
//			"pass_notify"			"Vote passed!"					<-- Printed to everyone's chat when the vote passes
//			"fail_notify"			"Vote failed!"					<-- Printed to everyone's chat when the vote fails to pass
//
//			"maplist"				"default"			<-- List of maps to populate the selection list (See maplist.cfg)
//			"currentmap"			"0"					<-- Allows/disallows casting selections on the current map
//			"recentmaps"			"3"					<-- How many recent maps will be removed from the vote selections
//
//			"chattrigger"			"vote"				<-- Chat trigger to open the vote selections (Do not include ! or / in the trigger)
//		}												<--	Leave this alone
//	}													<--	Leave this alone
//
// Formatting: Remember to add quotes as needed
//
// Place these in command, call_notify, pass_notify to your liking
// {VOTE_AMOUNT} - Amount of votes called for that item
// {VOTE_REQUIRED} - Required vote calls for that vote to pass
//
// {VOTER_INDEX} - Voter client index
// {VOTER_ID} - Voter user id
// {VOTER_STEAMID} - Voter SteamID32, encased in quotes
// {VOTER_NAME} - Voter name, encased in quotes
//
// {TARGET_INDEX} - Target client index
// {TARGET_ID} - Target user id
// {TARGET_STEAMID} - Target SteamID 32, encased in quotes
// {TARGET_NAME} - Target name, encased in quotes
//
// {MAP_NAME} - Map name
// {CURRENT_MAP_NAME} - Current map name
//
// {OPTION_NAME} - Option name
// {OPTION_RESULT} - Option result
//
// {On|Off}	- Control variable is On or Off
// {on|off}	- Control variable is on or off
//
// {Yes|No}	- Voter selected Yes or No
// {yes|no}	- Voter selected yes or no
//
// Formatting Examples:
//
// "call_notify"	"{olive}[SM] {VOTER_NAME}{default} voted to kick {green}{TARGET_NAME}{default}."
// "command"		"kickid #{TARGET_ID};sm_csay Kicked {TARGET_NAME}"
//

"Custom Votes"
{
	"Turn all talk {on|off}"
	{
		"type"			"simple"
		"vote"			"1"
		"ratio"			"0.6"
		"minimum"		"4"
		"command"		"sv_alltalk {on|off}"
		"cvar"			"sv_alltalk"
		"start_notify"	"[SM] {VOTER_NAME} ({VOTER_STEAMID}) started a vote to turn all-talk {on|off}."
		"call_notify"	"[SM] Vote cast for {yes|no}."
		"pass_notify"	"[SM] Vote passed."
		"fail_notify"	"[SM] Vote failed. Received: {VOTE_AMOUNT} Required: {VOTE_REQUIRED}"
		"chattrigger"	"votealltalk"
	}
	"Change the map"
	{
		"type"			"map"
		"vote"			"1"
		"ratio"			"0.5"
		"minimum"		"4"
		"command"		"sm_map {MAP_NAME}"
		"maplist"		"default"
		"recentmaps"	"3"
		"currentmap"	"0"
		"start_notify"	"[SM] {VOTER_NAME} ({VOTER_STEAMID}) started a vote to change the map to {MAP_NAME}."
		"call_notify"	"[SM] Vote cast for {yes|no}."
		"pass_notify"	"[SM] Vote passed."
		"fail_notify"	"[SM] Vote failed. Received: {VOTE_AMOUNT} Required: {VOTE_REQUIRED}"
		"chattrigger"	"votemap"
	}
	"Kick player"
	{
		"type"			"players"
		"vote"			"1"
		"minimum"		"4"
		"ratio"			"0.6"
		"command"		"sm_kick #{TARGET_ID} Server Vote"
		"start_notify"	"[SM] {VOTER_NAME} ({VOTER_STEAMID}) started a vote to kick {TARGET_NAME}."
		"call_notify"	"[SM] Vote cast for {yes|no}."
		"pass_notify"	"[SM] Vote passed."
		"fail_notify"	"[SM] Vote failed. Received: {VOTE_AMOUNT} Required: {VOTE_REQUIRED}"
		"chattrigger"	"votekick"
	}
	"Mute player"
	{
		"type"			"players"
		"vote"			"1"
		"minimum"		"4"
		"ratio"			"0.6"
		"immunity"		"50"
		"command"		"sm_silence #{TARGET_ID} 30 Server Vote"
		"start_notify"	"[SM] {VOTER_NAME} ({VOTER_STEAMID}) started a vote to mute {TARGET_NAME}."
		"call_notify"	"[SM] Vote cast for {yes|no}."
		"pass_notify"	"[SM] Vote passed."
		"fail_notify"	"[SM] Vote failed. Received: {VOTE_AMOUNT} Required: {VOTE_REQUIRED}"
		"chattrigger"	"votemute"
	}
}

To Reproduce
Steps to reproduce the behavior:

  1. Run sm_dump_handles filename.txt
  2. Open the file.
  • All handles open (in file you specified with sm_dump_handles)
0x03bb02fb	customvotes.smx     	Timer               	-1        
0x033602fc	customvotes.smx     	CellArray           	32788     
0x033702fd	customvotes.smx     	CellArray           	20        
0x033802fe	customvotes.smx     	CellArray           	20        
0x033902ff	customvotes.smx     	CellArray           	20        
0x033a0300	customvotes.smx     	CellArray           	20        
0x033b0301	customvotes.smx     	CellArray           	20        
0x033c0302	customvotes.smx     	CellArray           	20        
0x033d0303	customvotes.smx     	CellArray           	20        
0x033e0304	customvotes.smx     	CellArray           	20        
0x033f0305	customvotes.smx     	CellArray           	20        
0x03400306	customvotes.smx     	CellArray           	20        
0x03410307	customvotes.smx     	CellArray           	20        
0x03420308	customvotes.smx     	CellArray           	20        
0x03430309	customvotes.smx     	CellArray           	20        
0x0344030a	customvotes.smx     	CellArray           	20        
0x0345030b	customvotes.smx     	CellArray           	20        
0x0346030c	customvotes.smx     	CellArray           	20        
0x0347030d	customvotes.smx     	CellArray           	20        
0x0348030e	customvotes.smx     	CellArray           	20        
0x0349030f	customvotes.smx     	CellArray           	20        
0x034a0310	customvotes.smx     	CellArray           	20        
0x034b0311	customvotes.smx     	CellArray           	20        
0x034c0312	customvotes.smx     	CellArray           	20        
0x034d0313	customvotes.smx     	CellArray           	20        
0x034e0314	customvotes.smx     	CellArray           	20        
0x034f0315	customvotes.smx     	CellArray           	20        
0x03500316	customvotes.smx     	CellArray           	20        
0x03510317	customvotes.smx     	CellArray           	20        
0x03520318	customvotes.smx     	CellArray           	20        
0x03530319	customvotes.smx     	CellArray           	20        
0x0354031a	customvotes.smx     	CellArray           	20        
0x0355031b	customvotes.smx     	CellArray           	20        
0x0356031c	customvotes.smx     	CellArray           	20        
0x0357031d	customvotes.smx     	CellArray           	20        
0x0358031e	customvotes.smx     	CellArray           	20        
0x0359031f	customvotes.smx     	CellArray           	20        
0x035a0320	customvotes.smx     	CellArray           	20        
0x035b0321	customvotes.smx     	CellArray           	20        
0x035c0322	customvotes.smx     	CellArray           	20        
0x035d0323	customvotes.smx     	CellArray           	20        
0x035e0324	customvotes.smx     	CellArray           	20        
0x035f0325	customvotes.smx     	CellArray           	20        
0x03600326	customvotes.smx     	CellArray           	20        
0x03610327	customvotes.smx     	CellArray           	20        
0x03620328	customvotes.smx     	CellArray           	20        
0x03630329	customvotes.smx     	CellArray           	20        
0x0364032a	customvotes.smx     	CellArray           	20        
0x0365032b	customvotes.smx     	CellArray           	20        
0x0366032c	customvotes.smx     	CellArray           	20        
0x0367032d	customvotes.smx     	CellArray           	20        
0x0368032e	customvotes.smx     	CellArray           	20        
0x0369032f	customvotes.smx     	CellArray           	20        
0x036a0330	customvotes.smx     	CellArray           	20        
0x036b0331	customvotes.smx     	CellArray           	20        
0x036c0332	customvotes.smx     	CellArray           	20        
0x036d0333	customvotes.smx     	CellArray           	20        
0x036e0334	customvotes.smx     	CellArray           	20        
0x036f0335	customvotes.smx     	CellArray           	20        
0x03700336	customvotes.smx     	CellArray           	20        
0x03710337	customvotes.smx     	CellArray           	20        
0x03720338	customvotes.smx     	CellArray           	20        
0x03730339	customvotes.smx     	CellArray           	20        
0x0374033a	customvotes.smx     	CellArray           	20        
0x0375033b	customvotes.smx     	CellArray           	20        
0x0376033c	customvotes.smx     	CellArray           	20        
0x0377033d	customvotes.smx     	CellArray           	20        
0x0378033e	customvotes.smx     	CellArray           	20        
0x0379033f	customvotes.smx     	CellArray           	20        
0x037a0340	customvotes.smx     	CellArray           	20        
0x037b0341	customvotes.smx     	CellArray           	20        
0x037c0342	customvotes.smx     	CellArray           	20        
0x037d0343	customvotes.smx     	CellArray           	20        
0x037e0344	customvotes.smx     	CellArray           	20        
0x037f0345	customvotes.smx     	CellArray           	20        
0x03800346	customvotes.smx     	CellArray           	20        
0x03810347	customvotes.smx     	CellArray           	20        
0x03820348	customvotes.smx     	CellArray           	20        
0x03830349	customvotes.smx     	CellArray           	20        
0x0384034a	customvotes.smx     	CellArray           	20        
0x0385034b	customvotes.smx     	CellArray           	20        
0x0386034c	customvotes.smx     	CellArray           	20        
0x0387034d	customvotes.smx     	CellArray           	20        
0x0388034e	customvotes.smx     	CellArray           	20        
0x0389034f	customvotes.smx     	CellArray           	20        
0x038a0350	customvotes.smx     	CellArray           	20        
0x038b0351	customvotes.smx     	CellArray           	20        
0x038c0352	customvotes.smx     	CellArray           	20        
0x038d0353	customvotes.smx     	CellArray           	20        
0x038e0354	customvotes.smx     	CellArray           	20        
0x038f0355	customvotes.smx     	CellArray           	20        
0x03900356	customvotes.smx     	CellArray           	20        
0x03910357	customvotes.smx     	CellArray           	20        
0x03920358	customvotes.smx     	CellArray           	20        
0x03930359	customvotes.smx     	CellArray           	20        
0x0394035a	customvotes.smx     	CellArray           	20        
0x0395035b	customvotes.smx     	CellArray           	20        
0x0396035c	customvotes.smx     	CellArray           	20        
0x0397035d	customvotes.smx     	CellArray           	20        
0x0398035e	customvotes.smx     	CellArray           	20        
0x0399035f	customvotes.smx     	CellArray           	20        
0x039a0360	customvotes.smx     	CellArray           	20        
0x039b0361	customvotes.smx     	CellArray           	20        
0x039c0362	customvotes.smx     	CellArray           	20        
0x039d0363	customvotes.smx     	CellArray           	20        
0x039e0364	customvotes.smx     	CellArray           	20        
0x039f0365	customvotes.smx     	CellArray           	20        
0x03a00366	customvotes.smx     	CellArray           	20        
0x03a10367	customvotes.smx     	CellArray           	20        
0x03a20368	customvotes.smx     	CellArray           	20        
0x03a30369	customvotes.smx     	CellArray           	20        
0x03a4036a	customvotes.smx     	CellArray           	20        
0x03a5036b	customvotes.smx     	CellArray           	20        
0x03a6036c	customvotes.smx     	CellArray           	20        
0x03a7036d	customvotes.smx     	CellArray           	20        
0x03a8036e	customvotes.smx     	CellArray           	20        
0x03a9036f	customvotes.smx     	CellArray           	20        
0x03aa0370	customvotes.smx     	CellArray           	20        
0x03ab0371	customvotes.smx     	CellArray           	20        
0x03ac0372	customvotes.smx     	CellArray           	20        
0x03ad0373	customvotes.smx     	CellArray           	20        
0x03ae0374	customvotes.smx     	CellArray           	20        
0x03af0375	customvotes.smx     	CellArray           	20        
0x03b00376	customvotes.smx     	CellArray           	20        
0x03b10377	customvotes.smx     	CellArray           	20        
0x03b20378	customvotes.smx     	CellArray           	20        
0x03b30379	customvotes.smx     	CellArray           	20        
0x03b4037a	customvotes.smx     	CellArray           	20        
0x03b5037b	customvotes.smx     	CellArray           	20        
0x03b6037c	customvotes.smx     	CellArray           	20        
0x03b7037d	customvotes.smx     	CellArray           	20        
0x03b8037e	customvotes.smx     	CellArray           	20        
0x03b9037f	customvotes.smx     	CellArray           	20        
0x03ba0380	customvotes.smx     	CellArray           	20        

Expected behavior
I don't think this many array handles should be open.

Game Server

  • Sourcemod version
    SourceMod Version: 1.10.0.6394
    SourcePawn Engine: 1.10.0.6394, jit-x86 (build 1.10.0.6394)
    SourcePawn API: v1 = 5, v2 = 12
    Compiled on: Apr 11 2019 14:59:22
    Built from: https://github.com/alliedmodders/sourcemod/commit/e3f4d23
    Build ID: 6394:e3f4d23
    http://www.sourcemod.net/
  • Metamod version
    Metamod:Source version 1.11.0-dev+1127
    Plugin interface version: 16:14
    SourceHook version: 5:5
    Loaded As: Valve Server Plugin
    Compiled on: Mar 28 2019 17:00:56
    Built from: https://github.com/alliedmodders/metamod-source/commit/de33074
    Build ID: 1127:de33074
    http://www.metamodsource.net/
  • Custom Votes plugin version
  Filename: customvotes.smx
  Title: Custom Votes (Custom Votes)
  Author: ReFlexPoison,Anonymous Player
  Version: 1.16.3U
  URL: http://www.sourcemod.net/
  Status: running
  Timestamp: 03/12/2019 18:30:09
  Hash: 4b303372e3ac805571b0bf487865eb78
  • Game
    Team Fortress 2

Memory leak confirmed. I've noticed the number of handles used by the plugin increasing when the server changes map. In my server, 4 new handles were created every time the map was changed.

@caxanga334 Hey, I'd be interested in knowing whether this is fixed. I see related Projects task is marked as Done, but I couldn't easily find a related commit mentioning it. Is this solved?

@Adrianilloo Still not fixed. It was moved automatically to done when I archived the repo.