AtmoOmen / CurrencyTracker

FFXIV Dalamud Plugin Currency Tracker
4 stars 1 forks source link

Exception thrown after trade #18

Closed madness800 closed 8 months ago

madness800 commented 8 months ago

Hi,

Trading of any items will result in the plugin throwing unhandled exception in particularly if you are trading stacks of 999 with all the trade slot filled. This would renders the game to hang and ultimately dalamud just crash entirely.

The exception below is what written out into the log file, with the sheer number null reference exception is being thrown I guess the plugin is parsing each item (per stack) it see over the trade transaction?

2023-12-24 00:42:18.171 +00:00 [INF] LASTEXCEPTION:eyJXaGVuIjoiMjAyMy0xMi0yNFQwMDo0MjoxOC4xNzE2MDI2KzAwOjAwIiwiSW5mbyI6IlN5c3RlbS5BZ2dyZWdhdGVFeGNlcHRpb246IEEgVGFzaydzIGV4Y2VwdGlvbihzKSB3ZXJlIG5vdCBvYnNlcnZlZCBlaXRoZXIgYnkgV2FpdGluZyBvbiB0aGUgVGFzayBvciBhY2Nlc3NpbmcgaXRzIEV4Y2VwdGlvbiBwcm9wZXJ0eS4gQXMgYSByZXN1bHQsIHRoZSB1bm9ic2VydmVkIGV4Y2VwdGlvbiB3YXMgcmV0aHJvd24gYnkgdGhlIGZpbmFsaXplciB0aHJlYWQuIChPYmplY3QgcmVmZXJlbmNlIG5vdCBzZXQgdG8gYW4gaW5zdGFuY2Ugb2YgYW4gb2JqZWN0LilcclxuIC0tLT4gU3lzdGVtLk51bGxSZWZlcmVuY2VFeGNlcHRpb246IE9iamVjdCByZWZlcmVuY2Ugbm90IHNldCB0byBhbiBpbnN0YW5jZSBvZiBhbiBvYmplY3QuXHJcbiAgIGF0IEN1cnJlbmN5VHJhY2tlci5NYW5hZ2VyLlRyYWNrZXJzLkNvbXBvbmVudHMuVHJhZGUuRW5kVHJhZGUoKSBpbiAvd29yay9yZXBvL0N1cnJlbmN5VHJhY2tlci9NYW5hZ2VyL1RyYWNrZXJzL0NvbXBvbmVudHMvVHJhZGUuY3M6bGluZSA0N1xyXG4gICBhdCBTeXN0ZW0uVGhyZWFkaW5nLkV4ZWN1dGlvbkNvbnRleHQuUnVuRnJvbVRocmVhZFBvb2xEaXNwYXRjaExvb3AoVGhyZWFkIHRocmVhZFBvb2xUaHJlYWQsIEV4ZWN1dGlvbkNvbnRleHQgZXhlY3V0aW9uQ29udGV4dCwgQ29udGV4dENhbGxiYWNrIGNhbGxiYWNrLCBPYmplY3Qgc3RhdGUpXHJcbi0tLSBFbmQgb2Ygc3RhY2sgdHJhY2UgZnJvbSBwcmV2aW91cyBsb2NhdGlvbiAtLS1cclxuICAgYXQgU3lzdGVtLlRocmVhZGluZy5FeGVjdXRpb25Db250ZXh0LlJ1bkZyb21UaHJlYWRQb29sRGlzcGF0Y2hMb29wKFRocmVhZCB0aHJlYWRQb29sVGhyZWFkLCBFeGVjdXRpb25Db250ZXh0IGV4ZWN1dGlvbkNvbnRleHQsIENvbnRleHRDYWxsYmFjayBjYWxsYmFjaywgT2JqZWN0IHN0YXRlKVxyXG4gICBhdCBTeXN0ZW0uVGhyZWFkaW5nLlRhc2tzLlRhc2suRXhlY3V0ZVdpdGhUaHJlYWRMb2NhbChUYXNrJiBjdXJyZW50VGFza1Nsb3QsIFRocmVhZCB0aHJlYWRQb29sVGhyZWFkKVxyXG4gICAtLS0gRW5kIG9mIGlubmVyIGV4Y2VwdGlvbiBzdGFjayB0cmFjZSAtLS0iLCJDb250ZXh0IjoiVW5vYnNlcnZlZCBleGNlcHRpb24gaW4gVGFzay4ifQ==
2023-12-24 00:42:18.171 +00:00 [ERR] Unobserved exception in Task.
System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. (Object reference not set to an instance of an object.)
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at CurrencyTracker.Manager.Trackers.Components.Trade.EndTrade() in /work/repo/CurrencyTracker/Manager/Trackers/Components/Trade.cs:line 47
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   --- End of inner exception stack trace ---
AtmoOmen commented 8 months ago

I will have a test on this issue, and get back to you asap. Sorry for causing the crash.

madness800 commented 8 months ago

Hi,

Sort of on the similar error as above it looks like the plugin is throwing unhandled exception when the key doesn't exists as it tries to track an item/currency that's not been selected?

Also, its always the 2 same key id are being thrown

2023-12-25 09:21:14.979 +00:00 [ERR] [AddonLifecycle] Exception in OnAddonFinalize during PreFinalize invoke.
System.Collections.Generic.KeyNotFoundException: The given key '35823' was not present in the dictionary.
   at CurrencyTracker.Manager.Infos.CurrencyInfo.GetCurrencyAmount(UInt32 currencyID, TransactionFileCategory category, UInt64 ID) in /work/repo/CurrencyTracker/Manager/Infos/CurrencyInfo.cs:line 47
   at CurrencyTracker.Manager.Trackers.Tracker.CheckCurrency(UInt32 currencyID, String locationName, String noteContent, RecordChangeType recordChangeType, UInt32 source, TransactionFileCategory category, UInt64 ID) in /work/repo/CurrencyTracker/Manager/Trackers/Tracker.cs:line 89
   at CurrencyTracker.Manager.Trackers.Tracker.CheckCurrencies(IEnumerable`1 currencies, String locationName, String noteContent, RecordChangeType recordChangeType, UInt32 source, TransactionFileCategory category, UInt64 ID) in /work/repo/CurrencyTracker/Manager/Trackers/Tracker.cs:line 145
   at CurrencyTracker.Manager.Trackers.Components.PremiumSaddleBag.OnPremiumSaddleBag(AddonEvent type, AddonArgs args) in /work/repo/CurrencyTracker/Manager/Trackers/Components/PremiumSaddleBag.cs:line 38
   at Dalamud.Game.Addon.Lifecycle.AddonLifecycle.InvokeListenersSafely(AddonEvent eventType, AddonArgs args, String blame) in C:\goatsoft\companysecrets\dalamud\Game\Addon\Lifecycle\AddonLifecycle.cs:line 193
2023-12-25 09:21:14.987 +00:00 [INF] LASTEXCEP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FuZ2VUeXBlLCBVSW50MzIgc291cmNlLCBUcmFuc2FjdGlvbkZpbGVDYXRlZ29yeSBjYXRlZ29yeSwgVUludDY0IElEKSBpbiAvd29yay9yZXBvL0N1cnJlbmN5VHJhY2tlci9NYW5hZ2VyL1RyYWNrZXJzL1RyYWNrZXIuY3M6bGluZSAxNDVcclxuICAgYXQgQ3VycmVuY3lUcmFja2VyLk1hbmFnZXIuVHJhY2tlcnMuQ29tcG9uZW50cy5TYWRkbGVCYWcuT25TYWRkbGVCYWcoQWRkb25FdmVudCB0eXBlLCBBZGRvbkFyZ3MgYXJncykgaW4gL3dvcmsvcmVwby9DdXJyZW5jeVRyYWNrZXIvTWFuYWdlci9UcmFja2Vycy9Db21wb25lbnRzL1NhZGRsZUJhZy5jczpsaW5lIDM5XHJcbiAgIGF0IERhbGFtdWQuR2FtZS5BZGRvbi5MaWZlY3ljbGUuQWRkb25MaWZlY3ljbGUuSW52b2tlTGlzdGVuZXJzU2FmZWx5KEFkZG9uRXZlbnQgZXZlbnRUeXBlLCBBZGRvbkFyZ3MgYXJncywgU3RyaW5nIGJsYW1lKSBpbiBDOlxcZ29hdHNvZnRcXGNvbXBhbnlzZWNyZXRzXFxkYWxhbXVkXFxHYW1lXFxBZGRvblxcTGlmZWN5Y2xlXFxBZGRvbkxpZmVjeWNsZS5jczpsaW5lIDE5MyIsIkNvbnRleHQiOiJbQWRkb25MaWZlY3ljbGVdIEV4Y2VwdGlvbiBpbiBPbkFkZG9uRmluYWxpemUgZHVyaW5nIFByZUZpbmFsaXplIGludm9rZS4ifQ==
2023-12-25 09:21:14.987 +00:00 [ERR] [AddonLifecycle] Exception in OnAddonFinalize during PreFinalize invoke.
System.Collections.Generic.KeyNotFoundException: The given key '20' was not present in the dictionary.
   at CurrencyTracker.Manager.Infos.CurrencyInfo.GetCurrencyAmount(UInt32 currencyID, TransactionFileCategory category, UInt64 ID) in /work/repo/CurrencyTracker/Manager/Infos/CurrencyInfo.cs:line 47
   at CurrencyTracker.Manager.Trackers.Tracker.CheckCurrency(UInt32 currencyID, String locationName, String noteContent, RecordChangeType recordChangeType, UInt32 source, TransactionFileCategory category, UInt64 ID) in /work/repo/CurrencyTracker/Manager/Trackers/Tracker.cs:line 89
   at CurrencyTracker.Manager.Trackers.Tracker.CheckCurrencies(IEnumerable`1 currencies, String locationName, String noteContent, RecordChangeType recordChangeType, UInt32 source, TransactionFileCategory category, UInt64 ID) in /work/repo/CurrencyTracker/Manager/Trackers/Tracker.cs:line 145
   at CurrencyTracker.Manager.Trackers.Components.SaddleBag.OnSaddleBag(AddonEvent type, AddonArgs args) in /work/repo/CurrencyTracker/Manager/Trackers/Components/SaddleBag.cs:line 39
   at Dalamud.Game.Addon.Lifecycle.AddonLifecycle.InvokeListenersSafely(AddonEvent eventType, AddonArgs args, String blame) in C:\goatsoft\companysecrets\dalamud\Game\Addon\Lifecycle\AddonLifecycle.cs:line 193
AtmoOmen commented 8 months ago

The two issues you report will be fixed in the next update. Both of them resulted from the new service IGameInventory the plugin introduced not working in some specific cases in the last update.

https://github.com/goatcorp/DalamudPluginsD17/pull/3040

madness800 commented 8 months ago

Issue is appeared fixed with recent update