SHWotever / SimHub

Multi sim dashboard, bass shaker driver, ....
http://www.simhubdash.com/
769 stars 97 forks source link

"Memory leak" #1279

Closed D4viiS closed 1 year ago

D4viiS commented 1 year ago

Describe the bug While I'm using simhub, the program freezes and then crashes. It happens at random times and it always happens if the overlay has to update.

Simhub version 8.3.7

To Reproduce Steps to reproduce the behavior: I don't know how to reproduce it accept of having the simhub running with some overlay and waiting for it.

Expected behavior I expect it to run normally as it should.

Log files I'm joining the latest log file. SimHub.log

Additional context Form the logs I found out that "[2023-04-16 13:31:57,524] ERROR - Unhandled dispatcher errorSystem.OutOfMemoryException: Insufficient memory to continue the execution of the program" is somehow connected to the problem. On the discord I was told that it looks like a memory leak.

SHWotever commented 1 year ago

Hi thanks for the report,

Could you give me the most details as possible In order to reproduce the case ? Everything even of it feels anecdotal can help to reproduce the case. I would need to know/have : -all the log files (unfortunately you only sent the last one, if a specific event triggered the memory leak it will be in previous log files) -design in use (often memory leaks are specific to some components/conditions) ideally exporting the dash/overlay as you have it on your computer is the best -if you are using third party plugins, does disabling them solve the issue?

Nicolas

D4viiS commented 1 year ago

Hello, 1) I'm sending the rest of the logs. My bad and I'm sorry for that. All the logs are in the .rar file in the attachment.

2) Im using Garry Swallow plugin which I need for F1 TV overlay. (https:// www.racedepartment.com/downloads/simhub-tv-style-side-scrolling-leaderboards -timings-sidescreen.18746/ - plugin, https://www.racedepartment.com/ downloads/f1tv-tv-style-hud.53826/ - overlay)

Thanks for your fast reply and I'm sorry for sending not everything that you needed.

 

---------- Původní e-mail ---------- Od: Wotever @.> Komu: SHWotever/SimHub @.> Kopie: D4viiS @.>, Author @.> Datum: 16. 4. 2023 15:16:23 Předmět: Re: [SHWotever/SimHub] "Memory leak" (Issue #1279) "

Hi thanks for the report,

Could you give me the most details as possible In order to reproduce the case ? Everything even of it feels anecdotal can help to reproduce the case. I would need to know/have : -all the log files (unfortunately you only sent the last one, if a specific event triggered the memory leak it will be in previous log files) -design in use (often memory leaks are specific to some components/ conditions) ideally exporting the dash/overlay as you have it on your computer is the best -if you are using third party plugins, does disabling them solve the issue?

Nicolas

— Reply to this email directly, view it on GitHub (https://github.com/SHWotever/SimHub/issues/1279#issuecomment-1510379149), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AT4QI5O4B323KDIRNYPTDUTXBPWKHANCNFSM6AAAAAAXAB255U) . You are receiving this because you authored the thread. Message ID: < @.***> "

D4viiS commented 1 year ago

In terms of recreating it there is nothing specific. I just open the overlay and trying how long will it take to crash. It doesn't metter if I do something with the overlay or not. Maybe I found some article that could be related somehow to the problem but I'm not a programmer so I don't know. Just trying to help. Thanks for helping, David---------- Původní e-mail ---------- Od: Wotever @.> Komu: SHWotever/SimHub @.> Kopie: D4viiS @.>, Author @.> Datum: 16. 4. 2023 15:16:23 Předmět: Re: [SHWotever/SimHub] "Memory leak" (Issue #1279) "

Hi thanks for the report,

Could you give me the most details as possible In order to reproduce the case ? Everything even of it feels anecdotal can help to reproduce the case. I would need to know/have : -all the log files (unfortunately you only sent the last one, if a specific event triggered the memory leak it will be in previous log files) -design in use (often memory leaks are specific to some components/ conditions) ideally exporting the dash/overlay as you have it on your computer is the best -if you are using third party plugins, does disabling them solve the issue?

Nicolas

— Reply to this email directly, view it on GitHub (https://github.com/SHWotever/SimHub/issues/1279#issuecomment-1510379149), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AT4QI5O4B323KDIRNYPTDUTXBPWKHANCNFSM6AAAAAAXAB255U) . You are receiving this because you authored the thread. Message ID: < @.***> "

D4viiS commented 1 year ago

Hi,

I'm just writing to ask if there's been any progress and if there's anything else I can add or something I can help with. If you need any information regarding the problem I will do everything I can to give them to you.

Thanks,

David

SHWotever commented 1 year ago

Hi ! I was waiting for remaining extra informations :

-all the log files (unfortunately you only sent the last one, if a specific event triggered the memory leak it will be in previous log files) -if you are using third party plugins, does disabling them solve the issue?

D4viiS commented 1 year ago

Hi,

thanks for fast reply. I thought I sent all you wrote but there could me mistake on my side.

1) In the attachment I'm sending whole "Logs" folder in .zip format. I found out that if I turn halo hud on (available in overlay which I'm using, also Garry Swallow plugin needed -> link to both below) and will change between spectated cars the Simhub will crash in a shorter amount of time with "System.OutOfMemoryException" related to it. Basically when the Simhub updates the halo hud or standings. It looks that it reaches somesort of memory threshold and then the Simhub freezes and only way to close it is by closing it via task manager.

2) https://www.racedepartment.com/downloads/f1tv-tv-style-hud.53826/ https://www.racedepartment.com/downloads/simhub-tv-style-side-scrolling-leaderboards-timings-sidescreen.18746/

I'm using F1 TV style hud which needs to have Garry Swallow's plugin. I can't try turning either of them off because they both need to be active for the overlay to work.

Kind regards,

David

Logs.zip

SHWotever commented 1 year ago

Thanks, You pinpointed already some options in the plugin triggering the issue do not hesitate to report the conditions to the plugin author so he can take a look too. I will try to reproduce it on my end , but if it's happening in the plugin , I can't fix it on my end. It would be better to have conditions only involving simhub code, so I can reproduce it, unfortunately I can't fix third party plugins as it's code I can't change.

D4viiS commented 1 year ago

Yeah, not really sure if it's the plugin or the simhub, but if the whole program crashes, I figured it might be a problem on the simhub side. I will contact the author and see what he comes up with.

Thanks

SHWotever commented 1 year ago

Hi ! I checked I couldn't find anything related to dashboards, I found a leak but totally different and related to the control mapper plugin not related to any game situation/running, which had been fixed. Let me know if you find something not related to a third party plugin. Indeed a memory leak in a plugin will hit the whole application at the end once the memory is filled everything will fall apart.

mantazzo commented 1 year ago

Sorry for barging in into this - I've been trying to look into this issue myself a bit as it seems in certain combos we're hitting a "memory limit". From what I can tell, this is caused by a few things:

  1. This leak is likely being caused by GarySwallow's plugin - which is rather unfortunate as it's necessary for many "advanced" overlays which require specific information from the game. I tried experimenting with only that plugin (and a few basic other ones) enabled, and still got a similar OOM error.
  2. Also a potential problem is that the SimHub application is 32-bit. From what I can tell, this limits the memory usage for the app by a good margin (I think it's about 2GB allowed and after that it gets complicated) and with some of the "advanced" overlays enabled, SimHub's memory use reaches 2GB (and goes over) rather quickly.

Potential solutions, from what I have looked at (unfortunately, I'm not a proper dev, so I'm working on assumptions here):

SHWotever commented 1 year ago

Simhub is already large address aware, it's part of the compilation process no issues here. Switching to 64 bits is a big change and would require to rework (find alternatives, recompile) all the native libraries I'm using) but overall as long as a memory leak is running : 32bits/64bits/large address aware will just changes the delay or the form of the fatal end (swapping, slow down or out of memory).

Overall I like the idea of switching to 64bits, 32bits was an historic requirement for usb screens) I already did some process isolation work for a good half of the native libraries (usb screens runs in a isolated process which can now stay in 32bits if required). But overall that's not a solution for a memory leak.