Distance Timer Errors

I currently have a timer that is supposed to run every .1 seconds and print the distance between two entites, but after a couple of seconds I stop getting anything in my console and if I move the entity the distance does not change. Here is the code for the timer:

timer.Create("FlagTimer", .1, 0, function()
	local copflag = ents.Create( "weapon_flag" )
for k,v in ipairs(ents.FindByClass("info_player_red")) do
    if !IsValid(v) then continue end
	local pos1 = v:GetPos()
	local pos2 = copflag:GetPos()
	print( pos1:Distance( pos2 ) ) 

Any help would be appreciated. Thankyou!

You are creating 10 entity per second. Don’t do that.