AscensionGameDev / Intersect-Engine

Intersect provides a complete game development suite for creating 2d mmorpgs with no programming experience required!
https://www.freemmorpgmaker.com/
Other
223 stars 360 forks source link

bug: Server Game Time Exception #2394

Open Irokaiser opened 1 week ago

Irokaiser commented 1 week ago

Description

After running the server for ~24 hours this exception is thrown and the server shuts down.

Latest Intersect Build with no custom edits.

2024-11-16 01:46:14.645 [Error] Received unhandled exception from System.Threading.Thread: The added or subtracted value results in an un-representable DateTime. (Parameter 'value')

Server is now closing. Please wait while your game and player data is saved!

2024-11-16 01:46:14.663 [Error] ArgumentOutOfRangeException: The added or subtracted value results in an un-representable DateTime. (Parameter 'value')
    Stack:    at System.DateTime.ThrowDateArithmetic(Int32 param)
   at System.DateTime.AddTicks(Int64 value)
   at Intersect.Server.General.Time.Update() in /home/runner/work/TessaPrimeSource/TessaPrimeSource/Intersect.Server.Core/General/Time.cs:line 48
   at Intersect.Server.Core.LogicService.LogicThread.ThreadStart(ServerContext serverContext) in /home/runner/work/TessaPrimeSource/TessaPrimeSource/Intersect.Server.Core/Core/LogicService.LogicThread.cs:line 336

Steps to Reproduce

Version with bug

0.8.0-beta.239

Last version that worked well

0.7.0 I think

Affected platforms

Linux, I was not able test on other platforms

Did you find any workaround?

No response

Relevant log output

2024-11-16 01:46:14.645 [Error] Received unhandled exception from System.Threading.Thread: The added or subtracted value results in an un-representable DateTime. (Parameter 'value')

Server is now closing. Please wait while your game and player data is saved!

2024-11-16 01:46:14.663 [Error] ArgumentOutOfRangeException: The added or subtracted value results in an un-representable DateTime. (Parameter 'value')
    Stack:    at System.DateTime.ThrowDateArithmetic(Int32 param)
   at System.DateTime.AddTicks(Int64 value)
   at Intersect.Server.General.Time.Update() in /home/runner/work/TessaPrimeSource/TessaPrimeSource/Intersect.Server.Core/General/Time.cs:line 48
   at Intersect.Server.Core.LogicService.LogicThread.ThreadStart(ServerContext serverContext) in /home/runner/work/TessaPrimeSource/TessaPrimeSource/Intersect.Server.Core/Core/LogicService.LogicThread.cs:line 336


### Duplicate Bug Check

- [X] This bug report is not a duplicate to the best of my knowledge.
Irokaiser commented 1 week ago

Encountered again, seemingly every 24 Hours.

Arufonsu commented 1 week ago

Try this: within the time update method, add a try-catch block around where the time's Add method is called at in order to catch any ArgumentOutOfRangeException and reset the sGameTime to DateTime.Now if an exception occurs (this should prevent the server from crashing due to un-representable DateTime values).

https://diffy.org/diff/534a44ab91df4

time_fix_attempt.patch

Thanks for reporting, let us know if that ^ helps !