Ain't anybody got time fo dis

This commit is contained in:
DenialMC 2015-05-06 10:44:56 +03:00
parent a617cf7252
commit 5e45804b51
5 changed files with 5 additions and 245 deletions

View file

@ -2,7 +2,6 @@ from pandac.PandaModules import *
from direct.distributed import ParentMgr
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.task import Task
from direct.showbase import LeakDetectors
from otp.otpbase import OTPGlobals
import random
@ -68,9 +67,6 @@ class AIZoneDataObj:
self._nonCollidableParent.removeNode()
del self._nonCollidableParent
if hasattr(self, '_render'):
if hasattr(self, '_renderLeakDetector'):
self._renderLeakDetector.destroy()
del self._renderLeakDetector
self._render.removeNode()
del self._render
if hasattr(self, '_parentMgr'):
@ -85,8 +81,6 @@ class AIZoneDataObj:
def getRender(self):
if not hasattr(self, '_render'):
self._render = NodePath('render-%s-%s' % (self._parentId, self._zoneId))
if config.GetBool('leak-scene-graph', 0):
self._renderLeakDetector = LeakDetectors.SceneGraphLeakDetector(self._render)
return self._render
def getNonCollidableParent(self):

View file

@ -1,4 +1,3 @@
from direct.showbase import GarbageReport
from direct.distributed.PyDatagram import PyDatagram
from direct.distributed.MsgTypes import CLIENTAGENT_EJECT

View file

@ -7,34 +7,17 @@ from direct.distributed.PyDatagramIterator import PyDatagramIterator
from direct.fsm.ClassicFSM import ClassicFSM
from direct.fsm.State import State
from direct.gui.DirectGui import *
from direct.interval.IntervalGlobal import ivalMgr
from direct.showbase import LeakDetectors
from direct.showbase import MessengerLeakDetector
from direct.showbase import PythonUtil, GarbageReport, BulletinBoardWatcher
from direct.showbase.ContainerLeakDetector import ContainerLeakDetector
from direct.showbase.GarbageReportScheduler import GarbageReportScheduler
from direct.task import Task
import gc
import os
from pandac.PandaModules import *
import random
import string
import sys
import time
import types
from otp.avatar import Avatar
from otp.avatar import DistributedAvatar
from otp.avatar import Avatar, DistributedAvatar
from otp.avatar.DistributedPlayer import DistributedPlayer
from otp.distributed import DCClassImports
from otp.distributed import OtpDoGlobals
from otp.distributed import DCClassImports, OtpDoGlobals
from otp.distributed.OtpDoGlobals import *
from otp.distributed.TelemetryLimiter import TelemetryLimiter
from otp.otpbase import OTPGlobals
from otp.otpbase import OTPLocalizer
from otp.otpbase import OTPGlobals, OTPLocalizer
from otp.otpgui import OTPDialog
from toontown.chat.ChatGlobals import *
import sys, time, types, random
class OTPClientRepository(ClientRepositoryBase):
notify = directNotify.newCategory('OTPClientRepository')
@ -58,28 +41,6 @@ class OTPClientRepository(ClientRepositoryBase):
self.parentMgr.registerParent(OTPGlobals.SPHidden, NodePath())
self.timeManager = None
if config.GetBool('detect-leaks', 0) or config.GetBool('client-detect-leaks', 0):
self.startLeakDetector()
if config.GetBool('detect-messenger-leaks', 0) or config.GetBool('ai-detect-messenger-leaks', 0):
self.messengerLeakDetector = MessengerLeakDetector.MessengerLeakDetector('client messenger leak detector')
if config.GetBool('leak-messages', 0):
MessengerLeakDetector._leakMessengerObject()
if config.GetBool('run-garbage-reports', 0) or config.GetBool('client-run-garbage-reports', 0):
noneValue = -1.0
reportWait = config.GetFloat('garbage-report-wait', noneValue)
reportWaitScale = config.GetFloat('garbage-report-wait-scale', noneValue)
if reportWait == noneValue:
reportWait = 60.0 * 2.0
if reportWaitScale == noneValue:
reportWaitScale = None
self.garbageReportScheduler = GarbageReportScheduler(waitBetween=reportWait,
waitScale=reportWaitScale)
self._proactiveLeakChecks = config.GetBool('proactive-leak-checks', 1) or config.GetBool('client-proactive-leak-checks', 1)
self._crashOnProactiveLeakDetect = config.GetBool('crash-on-proactive-leak-detect', 1)
self.activeDistrictMap = {}
self.telemetryLimiter = TelemetryLimiter()
self.serverVersion = serverVersion
@ -314,21 +275,6 @@ class OTPClientRepository(ClientRepositoryBase):
if number >= 0:
self.dclassesByNumber[number] = dclass
def startLeakDetector(self):
if hasattr(self, 'leakDetector'):
return False
firstCheckDelay = config.GetFloat('leak-detector-first-check-delay', 2 * 60.0)
self.leakDetector = ContainerLeakDetector('client container leak detector', firstCheckDelay=firstCheckDelay)
self.objectTypesLeakDetector = LeakDetectors.ObjectTypesLeakDetector()
self.garbageLeakDetector = LeakDetectors.GarbageLeakDetector()
self.renderLeakDetector = LeakDetectors.SceneGraphLeakDetector(render)
self.hiddenLeakDetector = LeakDetectors.SceneGraphLeakDetector(hidden)
self.cppMemoryUsageLeakDetector = LeakDetectors.CppMemoryUsage()
self.taskLeakDetector = LeakDetectors.TaskLeakDetector()
self.messageListenerTypesLeakDetector = LeakDetectors.MessageListenerTypesLeakDetector()
return True
def getGameDoId(self):
return self.GameGlobalsId
@ -512,9 +458,6 @@ class OTPClientRepository(ClientRepositoryBase):
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
def exitShutdown(self):
if hasattr(self, 'garbageWatcher'):
self.garbageWatcher.destroy()
del self.garbageWatcher
self.handler = None
return
@ -826,158 +769,6 @@ class OTPClientRepository(ClientRepositoryBase):
self.notify.info('sending clientLogout')
messenger.send('clientLogout')
def detectLeakedGarbage(self, callback = None):
if not __debug__:
return 0
self.notify.info('checking for leaked garbage...')
if gc.garbage:
self.notify.warning('garbage already contains %d items' % len(gc.garbage))
report = GarbageReport.GarbageReport('logout', verbose=True)
numCycles = report.getNumCycles()
if numCycles:
msg = "You can't leave until you take out your garbage. See report above & base.garbage"
self.notify.info(msg)
report.destroy()
return numCycles
def detectLeakedTasks(self, extraTasks = None):
allowedTasks = ['dataLoop',
'resetPrevTransform',
'doLaterProcessor',
'eventManager',
'readerPollTask',
'heartBeat',
'gridZoneLoop',
'igLoop',
'audioLoop',
'asyncLoad',
'collisionLoop',
'shadowCollisionLoop',
'ivalLoop',
'downloadSequence',
'patchAndHash',
'slowCloseShardCallback',
'tkLoop',
'manager-update',
'downloadStallTask',
'clientSleep',
jobMgr.TaskName,
self.GarbageCollectTaskName,
'garbageCollectStates',
TelemetryLimiter.TaskName]
if extraTasks is not None:
allowedTasks.extend(extraTasks)
problems = []
for task in taskMgr.getTasks():
if not hasattr(task, 'name'):
continue
if task.name in allowedTasks:
continue
else:
if hasattr(task, 'debugInitTraceback'):
print task.debugInitTraceback
problems.append(task.name)
if problems:
print taskMgr
msg = "You can't leave until you clean up your tasks: {"
for task in problems:
msg += '\n ' + task
msg += '}\n'
self.notify.info(msg)
return len(problems)
else:
return 0
return
def detectLeakedEvents(self, extraHooks = None):
allowedHooks = ['destroy-fade',
'f9',
'meta-q',
'meta-q-repeat',
'meta-m',
'meta-q-repeat',
'meta-h',
'meta-h-repeat',
'control-f9',
'newDistributedDirectory',
'page_down',
'page_up',
'panda3d-render-error',
'PandaPaused',
'PandaRestarted',
'press-mouse2-fade',
'print-fade',
'release-mouse2-fade',
'resetClock',
'window-event',
'TCRSetZoneDone',
'aspectRatioChanged',
'newDistributedDirectory',
CConnectionRepository.getOverflowEventName(),
self._getLostConnectionEvent(),
'render-texture-targets-changed',
'gotExtraFriendHandles']
if hasattr(loader, 'hook'):
allowedHooks.append(loader.hook)
if extraHooks is not None:
allowedHooks.extend(extraHooks)
problems = []
for hook in messenger.getEvents():
if hook not in allowedHooks:
problems.append(hook)
if problems:
msg = "You can't leave until you clean up your messenger hooks: {"
for hook in problems:
whoAccepts = messenger.whoAccepts(hook)
msg += '\n %s' % hook
for obj in whoAccepts:
msg += '\n OBJECT:%s, %s %s' % (obj, obj.__class__, whoAccepts[obj])
if hasattr(obj, 'getCreationStackTraceCompactStr'):
msg += '\n CREATIONSTACKTRACE:%s' % obj.getCreationStackTraceCompactStr()
else:
try:
value = whoAccepts[obj]
callback = value[0]
guiObj = callback.im_self
if hasattr(guiObj, 'getCreationStackTraceCompactStr'):
msg += '\n CREATIONSTACKTRACE:%s' % guiObj.getCreationStackTraceCompactStr()
except:
pass
msg += '\n}\n'
self.notify.warning(msg)
return len(problems)
else:
return 0
return
def detectLeakedIntervals(self):
numIvals = ivalMgr.getNumIntervals()
if numIvals > 0:
print "You can't leave until you clean up your intervals: {"
for i in xrange(ivalMgr.getMaxIndex()):
ival = None
if i < len(ivalMgr.ivals):
ival = ivalMgr.ivals[i]
if ival == None:
ival = ivalMgr.getCInterval(i)
if ival:
print ival
if hasattr(ival, 'debugName'):
print ival.debugName
if hasattr(ival, 'debugInitTraceback'):
print ival.debugInitTraceback
print '}'
self.notify.info("You can't leave until you clean up your intervals.")
return numIvals
else:
return 0
return
def _abandonShard(self):
self.notify.error('%s must override _abandonShard' % self.__class__.__name__)
@ -1476,18 +1267,6 @@ class OTPClientRepository(ClientRepositoryBase):
def askAvatarKnown(self, avId):
return 0
def hashFiles(self, pyc):
for dir in sys.path:
if dir == '':
dir = '.'
if os.path.isdir(dir):
for filename in os.listdir(dir):
if filename.endswith('.pyo') or filename.endswith('.pyc') or filename.endswith('.py') or filename == 'library.zip':
pathname = Filename.fromOsSpecific(os.path.join(dir, filename))
hv = HashVal()
hv.hashFile(pathname)
pyc.mergeWith(hv)
def queueRequestAvatarInfo(self, avId):
pass

View file

@ -4051,14 +4051,6 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
def staticGetLogicalZoneChangeAllEvent():
return 'DOLogicalChangeZone-all'
def _garbageInfo(self):
if hasattr(self, 'inventory'):
if not hasattr(self.inventory, '_createStack'):
return 'inventory has no create stack'
else:
return self.inventory._createStack
return 'no inventory'
def flagAv(self, avId, reason, params):
self.notify.debug('reason: %s timepassed: %s' % (reason, globalClock.getFrameTime() - DistributedToonAI.lastFlagAvTime))
if reason == AV_FLAG_REASON_TOUCH and globalClock.getFrameTime() - DistributedToonAI.lastFlagAvTime > AV_TOUCH_CHECK_DELAY_AI:

View file

@ -10,7 +10,6 @@ class InventoryBase(DirectObject.DirectObject):
notify = DirectNotifyGlobal.directNotify.newCategory('InventoryBase')
def __init__(self, toon, invStr = None):
self._createStack = str(StackTrace().compact())
self.toon = toon
if invStr == None:
self.inventory = []
@ -299,7 +298,4 @@ class InventoryBase(DirectObject.DirectObject):
self.inventory[track][UBER_GAG_LEVEL_INDEX] = 1
self.calcTotalProps()
return None
def _garbageInfo(self):
return self._createStack
return None