-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pyfa crashes when I search my library #2121
Comments
Try following:
|
I haven't been able to do those steps yet, but I was hitting the back button today in the ship browser and received this error. pyfa v2.16.0 OS version: Windows-10-10.0.18362-SP0 #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method SFBrowserItem.OnPaint of <gui.builtinShipBrowser.categoryItem.CategoryItem object at 0x36D1A210>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method SFBrowserItem.OnPaint of <gui.builtinShipBrowser.categoryItem.CategoryItem object at 0x36D1A350>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method SFBrowserItem.OnPaint of <gui.builtinShipBrowser.categoryItem.CategoryItem object at 0x36D1A490>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method SFBrowserItem.OnPaint of <gui.builtinShipBrowser.categoryItem.CategoryItem object at 0x36D1A5D0>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method SFBrowserItem.OnPaint of <gui.builtinShipBrowser.categoryItem.CategoryItem object at 0x36D1A490>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method SFBrowserItem.OnPaint of <gui.builtinShipBrowser.categoryItem.CategoryItem object at 0x36D1A5D0>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method SFBrowserItem.OnPaint of <gui.builtinShipBrowser.categoryItem.CategoryItem object at 0x36D1A350>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method SFBrowserItem.OnPaint of <gui.builtinShipBrowser.categoryItem.CategoryItem object at 0x36D1A490>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method SFBrowserItem.OnPaint of <gui.builtinShipBrowser.categoryItem.CategoryItem object at 0x36D1A210>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method SFBrowserItem.OnPaint of <gui.builtinShipBrowser.categoryItem.CategoryItem object at 0x36D1A350>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method SFBrowserItem.OnPaint of <gui.builtinShipBrowser.categoryItem.CategoryItem object at 0x36D1A0D0>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method SFBrowserItem.OnPaint of <gui.builtinShipBrowser.categoryItem.CategoryItem object at 0x36D1A210>> returned a result with an error set #################### Traceback (most recent call last): |
This is likely unrelated, but I will look into it before next release. edit: I am unsure what could have caused it, most likely some bug deep down in wxpython/wxwidgets (the toolkit we use to build UI). I am updating its version for next release, so maybe it will resolve similar issues. I was not able to replicate it on my Windows machine. |
https://i.imgur.com/m28yvCp.png here's an error I'm getting when pyfa crashes after I search for something, it hands, and I close the app. I haven't been able to figure out the exact reason, it's hard to reproduce. But it appears that the more entries I have for that search the more likely the crash is (I have A LOT of saved fits) |
Had an error searching for a proteus https://i.imgur.com/hQmGyQv.png pyfa v2.16.2 OS version: Windows-10-10.0.18362-SP0 #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E293CB0>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E2940D0>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E294490>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E294A30>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E294DF0>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E295210>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E2955D0>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E295B70>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E295F30>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E296350>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E296710>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E296D00>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E298120>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E2984E0>> returned a result with an error set #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <bound method PyGauge.OnPaint of <gui.pyfa_gauge.PyGauge object at 0x1E2988A0>> returned a result with an error set |
Getting errors when I search now, for instance I searched for "astarte" and it threw this error now (before it wasn't). pyfa v2.16.3 OS version: Windows-10-10.0.18362-SP0 #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): #################### Traceback (most recent call last): |
I am getting this stack trace running from code on win10.
|
I am at loss what could've caused this. Could you try installing older versions of logbook and see if it helps? |
New version, similar (but not the exact same) crashes on search. What is logbook? Happy to install it if it helps. pyfa v2.17.0 OS version: Windows-10-10.0.18362-SP0 #################### wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ....\src\common\dcbufcmn.cpp(132) in wxBufferedDC::UnMask(): invalid backing store The above exception was the direct cause of the following exception: SystemError: <function SFBrowserItem.OnPaint at 0x000001D36372BDC0> returned a result with an error set #################### Traceback (most recent call last): |
Could you describe how often does it happen (1 search out of 5? 10?), how generic the search keyword is (how much results did you expect to receive), and send your fitting database files to phoenix@mail.ru (stripping of any sensitive data if you wish)? |
It happens on every search, the search would return hundreds of fits. |
Changing logbook version to 1.4.4 didnt help. |
Could you try using python 3.8.1 64 bit, wiping its pip cache (or using --no-cache-dir option) and reinstalling dependencies? |
I have sent you my saveddata.db as i have made no progress with this so far. |
Any progress on this? |
I think I got your fit DB during vacation and when got back forgot to attempt to reproduce it. I will try today/tomorrow. Do binary builds work for you btw? If they do, super likely it's some dependency issue. From your list i see wxpython 4.0.7post2. Try uninstalling it and using 4.0.6 with python 3.7 (not 3.8). I have not upgraded to 4.0.7 due to the way how it (mis)handles locales. |
I replaced contents of
Installed that into 64-bit python 3.7 (win10), moved your fit database into proper location and tried searching for a few times (common words like @Neugeniko how often does it crash for you? |
Try use search string neug |
1> Open pyfa |
It fails from .exe .zip and from code. |
I tried running 64 bit python 3.7 (win10) with the provided requirements and same problem. |
Okay, I reproduced it |
No idea what the root cause is, i suppose wx was running out of some system resources (some handles or something similar), or maybe it was pyfa bug. Nevertheless, we did not limit amount of results returned by search, which is quite foolish. I limited it by 100 in ce80d92. |
Thanks. |
I still get this even with the 100 limited fitlist, just not as often. I can happen quite often if i use the search term 'neug' and backspace it and re type it while clicking on a fit. seems like a timing thing really.
|
Basically if I search then backspace and search then backspace a few times it uses all the resources up again and makes this crash even with the 100 limit of fit results. |
I feel like I've seen this before. A while ago so my memory might not be serving me well here. This might happen if we're doing GUI things in a secondary thread. The fact that this is happening during search (which is spun off to it's own thread for performance) also reinforces this. If we have some sort of non-thread-safe callback that is rendering widgets, this might happen. |
Looks like this was a similar issue: #1723 Unfortunately, I could not reproduce at the time and there wasn't much information available apart from the errors, so I chalked it up to a fluke |
I did have a look around for possible solutions like implementing, https://wiki.wxpython.org/CallAfter, or something but is beyond me. |
I can take a look tonight to see what I can find out, but not being able to reproduce it myself I expect this will be a situation where tweaks are make and a build is provided for testing :/ |
You just need to type in search and backspace and type in enough times and it crashes no matter how small a search list you return. Just use my db and search for 'neug' and back space and type again several times.. |
@Neugeniko can you send me a copy of your DB at holmes.ryan.90+pyfa@gmail.com? I have a test DB with 200 fits but still can't get it to do it, so maybe it has something to do with your data :) |
Sorry, could have sworn I responded to this thread last week. I did take a look at the possibility of some sort of thread-unsafe operation happening, but it seems that we aren't using threading in the search (we're using it for market search, not fit search). The second stage of the fit browser uses a thread, but that gets the list of hulls for a selected category, and doesn't have anything to do with searching. |
I sent the file. |
Thanks @Neugeniko! I received it, but have been busy with another project this weekend. Will take a look tonight and see if I can reproduce. :) |
Yep, I'm able to at least reproduce it now.
So, there's that. Still have no idea how to debug this, but I'll fiddle around with it |
I'm on bc2cdcd. I can actually reproduce it with a very specific set of steps:
so keystrokes look like this: Every time, after that last If I reduce the limit on the search fits to 50 (from 100 set here (ce80d92)) and repeat, then it'll fail after repeating step 3) 10 times instead of 5 This is interesting... We used to have a problem with context menus, where once you run pyfa long enough, they would start to crash. Turns out that we were creating new ID's every time they were generated, and wxWidgets has a cap on the value represented by this (think it's an int16). The fix for that was to create a pool of IDs that the context menus would reuse. Not saying this is the same thing, but it feels similar. Seems like an issue where we are consuming some resource from wxWidgets while not destroying instances correctly. Just have to hunt it down now |
So, this deals with low level screen drawing. And unfortunately I'm not great with that. The best we could do is make a sample app with as little code as possible that shows the issue, and ask around the wxPython community for advise. I'm not really sure when we can get to that tho :( |
Actually, here's something interesting: Commenting this line out Pyfa/gui/builtinShipBrowser/sfBrowserItem.py Line 292 in 5b74c6c
I repeat the steps outlined above and run into this new error:
That's the only thing printed to stderr, and then it just dies (unlike the other errors which continue to generate) Looking around I come to this. Not very useful for this particular problem, but interesting nonetheless: https://stackoverflow.com/a/53796516/788054 I have a feeling this may be due to maybe the navigation bar and the widgets of the ship browser possibly having references to each other...? |
Hello I don't want to resurrect an old issue but there are many similar issues to this and this seems to have the most detailed information so I would like to post a hint on solving this problem permanantly. The most immediate reason for the crash is because GDI object count has exceeded 10000. This is the default value by windows and through registry you can change the value to 65k and delay the onset of the crash(but it will still crash). You can verify that this is indeed the issue by using this small script. Once GDI object count hit exactly 10k, crash will happen. The reason for this is that somewhere in pyfa, some new id is being created but not reclaimed properly. If it can be located and fixed, the problem will go away. import time, psutil
from ctypes import *
def getPID(processName):
for proc in psutil.process_iter():
try:
if processName.lower() in proc.name().lower():
return proc.pid
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
pass
return None;
def getGDIcount(PID):
PH = windll.kernel32.OpenProcess(0x400, 0, PID)
GDIcount = windll.user32.GetGuiResources(PH, 0)
windll.kernel32.CloseHandle(PH)
return GDIcount
#PID = getPID('Outlook')
PID = 45888
while True:
GDIcount = getGDIcount(PID)
print(f"{time.ctime()}, {GDIcount}")
time.sleep(1) It seems to me that the |
hmm...I seem to have figured out a hack to fix this bug. But I am not sure how to fix it properly. Will post a PR soon. So I tried the hammer below and it works. Now GDI object count remains stable. @DarkFenX There are still some small leaks I think, but nothing as dramatic anymore. def RemoveAllChildren(self):
gdi.gdiReport('before')
for widget in self._wList:
widget.Destroy()
for i in widget.__dict__.keys():
widget.__dict__[i] =None
del widget
#wx.Frame.DestroyChildren()
#wx.Yield()
gc.collect()
gdi.gdiReport('after')
gdi.output_memory()
self.Scroll(0, 0)
self._wList = [] |
First noticed this behavior in 2.16.0. I have a pretty large library of ships and as I type my search Pyfa will hang, won't generate an error but it freezes. I have to restart. If there is an error log somewhere let me know and I can upload it.
The text was updated successfully, but these errors were encountered: