sirhamsteralot / HaE-PBLimiter

Profiles pb's and damages them when their runtime goes over a set value
MIT License
11 stars 5 forks source link

[FATAL] Initializer: System.NullReferenceException #6

Closed Fank closed 6 years ago

Fank commented 6 years ago
20:56:30.1367 [FATAL]  Initializer: System.NullReferenceException: Object reference not set to an instance of an object.
   at HaE_PBLimiter.PBData.IteratePBs(Object src)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.TimerQueueTimer.CallCallback()
   at System.Threading.TimerQueueTimer.Fire()
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
System.NullReferenceException: Object reference not set to an instance of an object.
   at HaE_PBLimiter.PBData.IteratePBs(Object src)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.TimerQueueTimer.CallCallback()
   at System.Threading.TimerQueueTimer.Fire()
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

I was spawning some blueprings in creative

sirhamsteralot commented 6 years ago

any steps to reproduce?

Fank commented 6 years ago

nope, was just spaming different blueprints in creative. Were testing something something, so i needed to disable the plugin. Only have 1 server running right now, so im unable to find reproduction steps for it.

SplenectomY commented 6 years ago

I've also gotten this bug, just crashed my server. If I have time today I'll look at the code.

SplenectomY commented 6 years ago

I did a very quick look, In PBData.cs you have long pbOwner = tracker.PB.OwnerId; at line 57. This might need a null check for the .PB in case the programming block is removed from the server or something else. Just a if(tracker.PB != null) continue; right before that line might solve the issue, or at least stop the crashes.

sirhamsteralot commented 6 years ago

hmm i think that might be it actually tho i dont see how PB could ever be null

E: ill throw in the nullcheck for it anyways, its a good thing to have

SplenectomY commented 6 years ago

I thought the same thing, but I don't really know what else it could be. I'll look a little deeper once I can, but that's probably the only thing in there that could ever possibly be a null object.

sirhamsteralot commented 6 years ago

actually nvm i think i see it, the ownerName string is prolly null

sirhamsteralot commented 6 years ago

possibly fixed in commit a9b1bcd

pushing hotfix soon

sirhamsteralot commented 6 years ago

Possibly fixed in version v1.0.3.13

SplenectomY commented 6 years ago

Aha. Yeah you're probably right, considering the identity check runs this this.m_allIdentities.TryGetValue(identityId, out result); and if it doens't find it, there's no default value in TryGetIdentity(). It would just return null.

SplenectomY commented 6 years ago

Bad news, the latest version didn't fix the issue.

sirhamsteralot commented 6 years ago

if anyone has a minidump for this id really appreciate it

sirhamsteralot commented 6 years ago

you can try this release in the meantime, it has debug symbols turned on and a trycatch around the suspected area which should swallow the exception :( release

sirhamsteralot commented 6 years ago

could you try using this and seeing if it gives a better stacktrace? i refactored some bits so it should. HaE_PBLimiter.zip

sirhamsteralot commented 6 years ago

Note to self: might be a correlation to EEM

sirhamsteralot commented 6 years ago

Im going to close this issue as it seems to have been fixed in one of the newest plugin releases. removed the warning on startup in the newest release and pushed to stable.