bkacjios / m-overlay

A controller input display/overlay for Dolphin
MIT License
165 stars 44 forks source link

Application crashes after a while #164

Closed cbartsch closed 1 year ago

cbartsch commented 1 year ago

Describe the bug I am using m-overlay during my streams and I realized after a while the input display is just gone. Today I have only one clip where the input display is showing and all the later clips it's missing. The application just closed itself without any error message.

This is new after updating to version 2.1.0. And I think it happened on an older version too, some sort of memory leak?

Desktop (please complete the following information):

To Reproduce Use m-overlay with Slippi and OBS for 1+ hours.

Expected behavior Application does not crash

Debug console output

[DEBUG - 01:56:23] Love2D 11.4.0 - Mysterious Mysteries
[DEBUG - 01:56:23] Lua 5.1 (LuaJIT 2.1.0-beta3)
[DEBUG - 01:56:23] M'Overlay (2.1.0)
[INFO  - 01:56:23] [DOLPHIN] Hooked

Additional info Sometimes the application stops responding: image

bkacjios commented 1 year ago

The console log resets as soon as you re-open the program, so it looks like the log you provided was after you relaunched. Can you check if there's any crashlogs available in your config directory?

cbartsch commented 1 year ago

Doesn't look liie there's anything: image

I'll try checking the log next time it crashes, before reopening it.

cbartsch commented 1 year ago

OK so I just played some Unranked games with m-overlay open. It didn't crash but then I opened OBS and after a few games it crashed right when starting a game.

I show it with a Window capture like this: image

Log: console.log

cbartsch commented 1 year ago

Here's some more info from Windows Event Logs, not sure if those help at all:

Faulting application name: m-overlay-x64.exe, version: 2.1.0.0, time stamp: 0x61d1af1e
Faulting module name: lua51.dll, version: 0.0.0.0, time stamp: 0x61d1ae70
Exception code: 0xc0000005
Fault offset: 0x000000000004ddfc
Faulting process ID: 0x5c38
Faulting application start time: 0x01d93b41f31663d7
Faulting application path: H:\Dropbox (Personal)\stream\m-overlay\m-overlay-x64.exe
Faulting module path: H:\Dropbox (Personal)\stream\m-overlay\lua51.dll
Report ID: 313743e4-b92b-43ce-8371-e5f2fa2cbc53
Faulting package full name: 
Faulting package-relative application ID: 
Fault bucket , type 0
Event Name: APPCRASH
Response: Not available
Cab Id: 0

Problem signature:
P1: m-overlay-x64.exe
P2: 2.1.0.0
P3: 61d1af1e
P4: lua51.dll
P5: 0.0.0.0
P6: 61d1ae70
P7: c0000005
P8: 000000000004ddfc
P9: 
P10: 

Attached files:

These files may be available here:
\\?\C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_m-overlay-x64.ex_2be213534e8ace197b85f5c44f85f4fd1a799d7_1b66d2dd_12acf131-3fd1-4210-a245-393bca3868f0

Analysis symbol: 
Rechecking for solution: 0
Report Id: 313743e4-b92b-43ce-8371-e5f2fa2cbc53
Report Status: 4
Hashed bucket: 
Cab Guid: 0
Fault bucket 1325386182198994988, type 4
Event Name: APPCRASH
Response: Nicht verfügbar
Cab Id: 0

Problem signature:
P1: m-overlay-x64.exe
P2: 2.1.0.0
P3: 61d1af1e
P4: lua51.dll
P5: 0.0.0.0
P6: 61d1ae70
P7: c0000005
P8: 000000000004ddfc
P9: 
P10: 

Attached files:
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER82FA.tmp.WERInternalMetadata.xml

These files may be available here:
\\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_m-overlay-x64.ex_2be213534e8ace197b85f5c44f85f4fd1a799d7_1b66d2dd_12acf131-3fd1-4210-a245-393bca3868f0

Analysis symbol: 
Rechecking for solution: 0
Report Id: 313743e4-b92b-43ce-8371-e5f2fa2cbc53
Report Status: 268435456
Hashed bucket: 81277dfab46c4a9ac264b7b5e42ea82c
Cab Guid: 0
<?xml version="1.0" encoding="UTF-16"?>
<WERReportMetadata>
    <OSVersionInformation>
        <WindowsNTVersion>10.0</WindowsNTVersion>
        <Build>19044</Build>
        <Product>(0x79): Windows 10 Education</Product>
        <Edition>Education</Edition>
        <BuildString>19041.2486.amd64fre.vb_release.191206-1406</BuildString>
        <Revision>2486</Revision>
        <Flavor>Multiprocessor Free</Flavor>
        <Architecture>X64</Architecture>
        <LCID>1031</LCID>
    </OSVersionInformation>
    <ProblemSignatures>
        <EventType>APPCRASH</EventType>
        <Parameter0>m-overlay-x64.exe</Parameter0>
        <Parameter1>2.1.0.0</Parameter1>
        <Parameter2>61d1af1e</Parameter2>
        <Parameter3>lua51.dll</Parameter3>
        <Parameter4>0.0.0.0</Parameter4>
        <Parameter5>61d1ae70</Parameter5>
        <Parameter6>c0000005</Parameter6>
        <Parameter7>000000000004ddfc</Parameter7>
    </ProblemSignatures>
    <DynamicSignatures>
        <Parameter1>10.0.19044.2.0.0.256.121</Parameter1>
        <Parameter2>2057</Parameter2>
        <Parameter22>19c6</Parameter22>
        <Parameter23>19c6e72383efef36135b9705bbaa6ac5</Parameter23>
        <Parameter24>231b</Parameter24>
        <Parameter25>231b197cdc44fd07a5c4ab38d9b56cbc</Parameter25>
    </DynamicSignatures>
    <SystemInformation>
        <MID>D3A1A55A-BFF8-4BDF-9B48-1DBEC8FE5ABA</MID>
        <SystemManufacturer>Micro-Star International Co., Ltd.</SystemManufacturer>
        <SystemProductName>MS-7B79</SystemProductName>
        <BIOSVersion>H.00</BIOSVersion>
        <OSInstallDate>1638819226</OSInstallDate>
        <OSInstallTime>1601-01-02T22:32:23Z</OSInstallTime>
        <TimeZoneBias>-01:00</TimeZoneBias>
    </SystemInformation>
    <SecureBootState>
        <UEFISecureBootEnabled>NotCapable</UEFISecureBootEnabled>
    </SecureBootState>
    <ReportInformation>
        <Guid>12acf131-3fd1-4210-a245-393bca3868f0</Guid>
        <CreationTime>2023-02-07T23:03:10Z</CreationTime>
    </ReportInformation>
</WERReportMetadata>
bkacjios commented 1 year ago

So the crash is coming from the Lua scripting engine this application uses. Makes things difficult to debug, but I'm going to try and replicate the crash on my end.

cbartsch commented 1 year ago

So today I streamed for 5 hours and it didn't crash. I had the "debug inputs" enabled last time where it shows your stick X/Y coordinates. Disabled it today. Maybe it's got to do with that?

Also when closing it after stream, it hung again: image

jjvliu commented 1 year ago

I have the same issue with M'Overlay and Melee. My case also started after 2.10 and leaves no crashlogs in the config directory. I do not have debug inputs enabled.

  1. Every 5 games or so, the application silently exits. For me it is very obvious because the music stops. This only ever occurs after a game ends, when going back to the character select screen. I mostly play local Versus Mode.

  2. After most sessions, the application stops responding after closing Dolphin (Slippi). Here is a Windows event log:

Log Name:      Application
Source:        Application Error
Date:          2023-02-11 11:49:10 AM
Event ID:      1000
Task Category: (100)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      Teostra
Description:
Faulting application name: m-overlay-x64.exe, version: 2.1.0.0, time stamp: 0x61d1af1e
Faulting module name: lua51.dll, version: 0.0.0.0, time stamp: 0x61d1ae70
Exception code: 0xc0000005
Fault offset: 0x0000000000042689
Faulting process id: 0x948
Faulting application start time: 0x01d93e505cacac2e
Faulting application path: C:\Users\Jimmy\AppData\Local\Programs\M'Overlay\m-overlay-x64.exe
Faulting module path: C:\Users\Jimmy\AppData\Local\Programs\M'Overlay\lua51.dll
Report Id: c9fe9417-394a-4d52-9786-09ab8018eccc
Faulting package full name: 
Faulting package-relative application ID: 
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Application Error" />
    <EventID Qualifiers="0">1000</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>100</Task>
    <Opcode>0</Opcode>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2023-02-11T19:49:10.5664996Z" />
    <EventRecordID>86827</EventRecordID>
    <Correlation />
    <Execution ProcessID="0" ThreadID="0" />
    <Channel>Application</Channel>
    <Computer>Teostra</Computer>
    <Security />
  </System>
  <EventData>
    <Data>m-overlay-x64.exe</Data>
    <Data>2.1.0.0</Data>
    <Data>61d1af1e</Data>
    <Data>lua51.dll</Data>
    <Data>0.0.0.0</Data>
    <Data>61d1ae70</Data>
    <Data>c0000005</Data>
    <Data>0000000000042689</Data>
    <Data>948</Data>
    <Data>01d93e505cacac2e</Data>
    <Data>C:\Users\Jimmy\AppData\Local\Programs\M'Overlay\m-overlay-x64.exe</Data>
    <Data>C:\Users\Jimmy\AppData\Local\Programs\M'Overlay\lua51.dll</Data>
    <Data>c9fe9417-394a-4d52-9786-09ab8018eccc</Data>
    <Data>
    </Data>
    <Data>
    </Data>
  </EventData>
</Event>
cbartsch commented 1 year ago

Update - I had it crash today, looks like it died after about 2 hours of streaming. Video: https://www.twitch.tv/videos/1738607916?t=00h07m09s

It just disappears after that game linked in the timestamp.

Very annoying because it closes without an error message so I usually miss that it's gone, and alter can't analyze my clips/vods (which is btw the most awesome thing, thanks for making m-overlay in the first place!)

voguelike commented 1 year ago

i've been having this issue constantly for a while now. the app randomly crashes by either silently quitting or most of the time it successfully stays on the error screen. it happens extremely often and seems to depend on the state of the slippi emulator since in some occasions i can get it to keep crashing 100% of the time immediately after reopening it until i relaunch slippi.

the most common error that i get like 99% of the time is this one:

modules/memory/init.lua:221: bad argument #1 to 'lshift' (number expected, got nil)
stack traceback:
    [C]: in function 'lshift'
    modules/memory/init.lua:221: in function 'read'
    modules/memory/init.lua:333: in function 'update'
    modules/memory/init.lua:439: in function 'update'
    modules/memory/init.lua:439: in function 'update'
    modules/memory/init.lua:630: in function 'updatememory'
    modules/memory/init.lua:598: in function 'update'
    main.lua:219: in function 'update'
    [love "callbacks.lua"]:162: in function <[love "callbacks.lua"]:144>
    [C]: in function 'xpcall'
    [love "boot.lua"]:370: in function <[love "boot.lua"]:337>

but i could find these other two in my logs:

modules/memory/windows.lua:297: attempt to perform arithmetic on 'void' and 'uint64_t'
stack traceback:
    modules/memory/windows.lua:297: in function 'findGamecubeRAMOffset'
    modules/memory/init.lua:593: in function 'update'
    main.lua:219: in function 'update'
    [love "callbacks.lua"]:162: in function <[love "callbacks.lua"]:144>
    [C]: in function 'xpcall'
    [love "boot.lua"]:370: in function <[love "boot.lua"]:337>
modules/memory/windows.lua:297: attempt to perform arithmetic on 'const void *' and 'uint64_t'
stack traceback:
    modules/memory/windows.lua:297: in function 'findGamecubeRAMOffset'
    modules/memory/init.lua:593: in function 'update'
    main.lua:219: in function 'update'
    [love "callbacks.lua"]:162: in function <[love "callbacks.lua"]:144>
    [C]: in function 'xpcall'
    [love "boot.lua"]:370: in function <[love "boot.lua"]:337>
bkacjios commented 1 year ago

Interesting. That certainly helps. I left dolphin running over night with the overlay open and didn't get a crash at all, so it must be related to the memory reading.

Since you can replicate it so easily I can make a build which logs every single update of memory the application is receiving and decoding. I'll try to get it uploaded for you sometime tomorrow. There must be an unexpected memory state which is causing things to break.

bkacjios commented 1 year ago

But after following along that stack trace, looks like it's following a pointer to another pointer then erroring when trying to decode a JIS string, probably the player names. I don't actually use those values for anything but had been toying around with an idea for displaying ranks a bit ago.

I'm curious if you ran into any players with weird characters in their name?

voguelike commented 1 year ago

not that i've noticed, and it happens so often that it seems like the crashes definitely shouldn't be caused by weird characters. at least not for the majority of them.

bkacjios commented 1 year ago

m-overlay-x64-portable.zip

Mind giving this test build a try? I realized I was using 32bit address spaces for determine the memory region of the gamecube ram. Changed that to handle 64bit as it should. Also disabled the suspect areas of memory I was reading from.

voguelike commented 1 year ago

i tried it out for a bit more than an hour and it seems good! i'd like to give it some more thorough testing to make sure but it's looking really good

bkacjios commented 1 year ago

Alright, cool. Thanks for testing. If it seems all good by tomorrow night I'll push an official update.

voguelike commented 1 year ago

awww damn unfortunately the next session i quickly got the same common crash.

modules/memory/init.lua:221: bad argument #1 to 'lshift' (number expected, got nil)
stack traceback:
    [C]: in function 'lshift'
    modules/memory/init.lua:221: in function 'read'
    modules/memory/init.lua:333: in function 'update'
    modules/memory/init.lua:439: in function 'update'
    modules/memory/init.lua:439: in function 'update'
    modules/memory/init.lua:630: in function 'updatememory'
    modules/memory/init.lua:598: in function 'update'
    main.lua:219: in function 'update'
    [love "callbacks.lua"]:162: in function <[love "callbacks.lua"]:144>
    [C]: in function 'xpcall'
    [love "boot.lua"]:370: in function <[love "boot.lua"]:337>
bkacjios commented 1 year ago

That.. makes no sense. It's erroring decoding a memory type that I completely disabled in that build I provided.

bkacjios commented 1 year ago

I'm a dumb ass. I forgot my portable version is just a launcher now that downloads the latest official release from here. I'll need to make a new build for you to try without that..

bkacjios commented 1 year ago

m-overlay-x64-portable.zip

Try this. You will know it's a debug build if you check the about tab in the escape menu. The version will look weird. There's also a dark mode theme I was working on..

Image

voguelike commented 1 year ago

alright well it seems like that crash is gone, however there seems to be another one that causes it to close with no crashlog or any errors in the console, most likely unrelated to the previous issues.

just in case it's useful, here's the last thing in the log before it closes itself:

[DEBUG - 01:09:26] [MUSIC] Killed music
[DEBUG - 01:09:26] [RANDOM] Obtained seed "0x83E3" from the previous seed
[INFO  - 01:09:26] [MUSIC] Found 3 songs in "Melee/Menu Music"
[DEBUG - 01:09:26] [AUTOPORT] Forcing port 1 in menus
[DEBUG - 01:09:26] [MEMORY] [0x8043208F  = 0x00000000] player.1.select.character = 0
[DEBUG - 01:09:26] [MEMORY] [0xFFFFFFFF810D9E00 -> 0xFFFFFFFF810D9E40] slippi -> 0xFFFFFFFF810D9E40
[DEBUG - 01:09:26] [MEMORY] [0x804D6CBC -> 0xFFFFFFFF81107000] online -> 0xFFFFFFFF81107000
[DEBUG - 01:09:26] [MEMORY] [0x80432090  = 0x00000003] player.1.select.skin = 3
[INFO  - 01:09:26] [MUSIC] Playing track #1 for menu
[DEBUG - 01:09:26] [MEMORY] [0xFFFFFFFF810D9E43  = 0x00000001] slippi.local_player.index = 1
bkacjios commented 1 year ago

I almost wonder if it's a bad song causing the crash.. I can't replicate the crash on my end, so I really don't think it's a memory reading issue. I can change the "playing track" message to include the file path of the song. Hopefully this can help pinpoint a possible cause for the crash.

cbartsch commented 1 year ago

For the record, I don't use the music feature at all and also get crashes.

I'll check if the debug build still crashes next time I stream.

bkacjios commented 1 year ago

Damn.. I'm really at a loss. I did just push out an update with the fixes for the errors @voguelike mentioned, so the beta should be obsolete now.

cbartsch commented 1 year ago

Thanks, I'll try the update today.

c-bartsch commented 1 year ago

So far no crashes with the versionf rom https://github.com/bkacjios/m-overlay/issues/164#issuecomment-1461112812

I do get the #169 though if you close m-overlay after closing Dolphin.

jjvliu commented 1 year ago

I still get these crashes sometimes on 2.1.1a while playing. When it happens, it is always when returning to character selection after a game. The application silently exits (no hang) like in the original post above.