nomns / nparse

Nomns' Parser for Project1999
GNU General Public License v3.0
43 stars 23 forks source link

Crash when casting spell #69

Closed Dgc2002 closed 2 months ago

Dgc2002 commented 4 months ago

I initially commented under #62 but now I'm unsure if this is the same problem.

After several weeks of using nparse without issue it began crashing when it would attempt to track a spell.

The crash generated crash dump has the following exception info

ExceptionAddress: 72fef081 (Qt5Core+0x0001f081)
   ExceptionCode: c0000409 (Security check failure or stack buffer overrun)
  ExceptionFlags: 00000001
NumberParameters: 1
   Parameter[0]: 00000007
Subcode: 0x7 FAST_FAIL_FATAL_APP_EXIT 

PROCESS_NAME:  nparse.exe

ERROR_CODE: (NTSTATUS) 0xc0000409 - The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application.

It appears that swapping out log files and using freshly generated ones can fix the issue temporarily. Recently it seemed I needed to remove every log file in the Log directory, not just the current character's file, to prevent the crashes.

I attempted to debug this via PyCharm but I was unable to get the debugger to break when an exception occurred in the QT DLL.

token419 commented 4 months ago

I happened to be tinkering around with this the other night because I just ran across this neat app and encountered the same issue while digging around to see if i could expand on the triggers to get a little more "gina" like.

I believe this and #62 may be related to the current master branch, which appears to be qt6 (which is not the release version, that version is the stable/qt5 version it looks like).

I was able to resolve this by changing the "parsers/spells.py" on line 320 from progress_layout.insertStretch(2, 1) to progress_layout.insertStretch(1, 1) in the master qt6 version.

So far after making that change on python 3.12 on windows 10 everything seems to be running fine locally for me now and the spell window no longer crashes the app, but I haven't tested much further as I was only tinkering around.

Though it is worth mentioning, as I was investigating as well, it looks like the "stable/qt5" branch is a few commits ahead and also appears to be where the releases are coming from.

I'd be happy to submit a pull request if this resolves the issue for others as well, but being as this isn't the branch being released, and it's a few commits behind, I'm not sure if it's still active.

token419 commented 4 months ago

It's also worth mentioning when I loaded the stable/qt5 branch i was getting crashes also, but I believe they are unrelated. I was also able to get that version running in python 3.12 on windows 10 as well. I had to remove the pinned QT5 requirement in the requirements.txt and used the newest version, then some items needed to be specifically casted to INT's (This work was already done in the master/qt6 version mostly).

I'd also be happy to submit a pull request for that as well if needed/wanted if the goal is to keep the QT5 branch living on also since it appears to be where the current commits/releases are coming from.

Dgc2002 commented 4 months ago

I believe this and #62 may be related to the current master branch, which appears to be qt6 (which is not the release version, that version is the stable/qt5 version it looks like).

The crash happens in the release and master branch version for me.

I was able to resolve this by changing the "parsers/spells.py" on line 320 from progress_layout.insertStretch(2, 1) to progress_layout.insertStretch(1, 1) in the master qt6 version.

I still experience crashes on the master branch after making this change. I haven't tried it on 3.12 though.

It seems pretty unpredictable at points. Sometimes wiping my log directory works. Other times I can just relaunch and it seems to be fine for hours.

I'm not digging into the crash dump of every individual crash to verify it's the exact same crash so it's possible I'm experiencing separate issues but at this point it all seems to be when I cast a spell.

token419 commented 4 months ago

Ah for sure, yeah the issue I was experiencing was a hard crash upon the first buff I cast. Like if I cast a self buff, the app immediately crashed. I did notice though that upon starting the app, i did have to hail once before it would catch the spell cast. Also I fat fingered previously, it was line 330, but yeah the value was the change that mattered heh.

I just pulled down master again just to verify. Here's my pip freeze just in case some dependencies got updated too or whatnot:


charset-normalizer==3.3.2
colorhash==2.0.0
darkdetect==0.8.0
idna==3.6
pathvalidate==3.2.0
PyQt6==6.6.1
PyQt6-Qt6==6.6.2
PyQt6-sip==13.6.0
PyQt6-WebEngine==6.6.0
PyQt6-WebEngine-Qt6==6.6.2
PySide6==6.6.2
PySide6_Addons==6.6.2
PySide6_Essentials==6.6.2
requests==2.31.0
semver==3.0.2
shiboken6==6.6.2
urllib3==2.2.1
websocket-client==1.7.0
websockets==12.0```
rm-you commented 3 months ago

@Dgc2002 @token419 Hey! Yeah, you hit the nail on the head here at every point. Yes, the releases are coming from the stable/qt5 branch. The reason for that was I couldn't figure out why spellcasting was crashing it, as I similarly couldn't get any breakpoints to fire. Since I maintain this in my very limited free time, I kinda gave up for a while on the qt6 upgrade.

I'll test out the change you mentioned, or please do feel free to make a PR, I was just talking to someone else about trying to solve this issue again and noticed you may have figured it out. I will port the other changes into this branch soon so it will be up to date with the latest release.

Thanks for taking a look! You can also hit me up on Discord, I honestly only saw this issue by pure chance -- I'm rm_you and I'm in a bunch of P99 guild/tools discords.

token419 commented 3 months ago

For sure, happy to help out! Thanks for keeping your work in the open so I had a codebase to play with! Honestly, from me to you, without your work being in the public, specifically the PyQT6 port commits, I wouldn't have even touched the project! I know nothing of QT in general and haven't been programming regularly in awhile, let alone with python.

I'll defer to you on merging/rebasing the 2 branches back together but would be more than happy to help as well if needed/wanted. I just don't want to build a massive pull request on one side or the other to get the branches up to date and then have my user tagged with all the commits for work you've already done!

I thought the project may be dead so I had actually just gone through every version of the codebase across all the forks and chose Nomn's 0.5.1 version to play with locally (I just used the source from the release page). I'll be honest, I specifically chose 0.5.1 because I had 0 personal interest in the location server. I got the old codebase working on python 3.12 and Pyside6 instead of PyQT6.

But since the project is still alive, I'd be happy to combine efforts. In the end I may still go my own route, but there's many things that can still mutually benefit us both.

Below are just some random though about my goals as well as what I've observed in the code:

rm-you commented 2 months ago

Resolved in #70 Thanks @token419