Skip to content
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

Segmentation Fault when deleting a fit that is being viewed. #164

Closed
Neugeniko opened this issue Sep 1, 2014 · 18 comments
Closed

Segmentation Fault when deleting a fit that is being viewed. #164

Neugeniko opened this issue Sep 1, 2014 · 18 comments

Comments

@Neugeniko
Copy link
Contributor

Software: Slackware 14.1 linux installation
Packages: wxPython-2.8.12.1-i486-2_SBo.tgz, SQLAlchemy-0.9.6-i486-1_SBo.tgz, python-dateutil-2.2-i486-1_SBo.tgz, matplotlib-1.1.1-i486-1_SBo.tgz, numpy-1.8.0-i486-1_SBo.tgz
Hardware: 1.7Ghz Celeron 32-bit (Single core)

Steps to reproduce.

  1. View a fit.
  2. Delete the fit as its being viewed.

Other messages: Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem.

Cheers,
Neug

@Neugeniko
Copy link
Contributor Author

Don't have much experience with debugging but maybe this will help.

bash-4.2$ gdb -ex r --args python pyfa.py
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-slackware-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/python2.7...(no debugging symbols found)...done.
Starting program: /usr/bin/python pyfa.py
warning: Could not load shared library symbols for linux-gate.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Traceback (most recent call last):
  File "/usr/share/gdb/auto-load/usr/lib/libgobject-2.0.so.0.3600.4-gdb.py", line 9, in <module>
    from gobject import register
  File "/usr/share/glib-2.0/gdb/gobject.py", line 3, in <module>
    import gdb.backtrace
ImportError: No module named backtrace
[New Thread 0xb3f69b40 (LWP 4509)]
[New Thread 0xb27ffb40 (LWP 4510)]
[New Thread 0xb1dffb40 (LWP 4511)]
[New Thread 0xb15ffb40 (LWP 4512)]
[Thread 0xb3f69b40 (LWP 4509) exited]
[New Thread 0xb3f69b40 (LWP 4513)]
[Thread 0xb3f69b40 (LWP 4513) exited]

Program received signal SIGSEGV, Segmentation fault.
0xb6f84922 in wxEvtHandler::SearchDynamicEventTable(wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0

Cheers,
Neug

@blitzmann
Copy link
Collaborator

Confirmed on Ububtu / Arch. Doesn't affect Windows build.

I also don't have much experience with using debugging programs. wish me luck ;D

@Neugeniko
Copy link
Contributor Author

My linux distribution gdb (gnu debugger) doesn't seem to have a python
module for better debugging, to get any further I think i'll need to
compile gdb from source.

Neug

On 3 September 2014 04:25, Ryan Holmes [email protected] wrote:

Confirmed on Ububtu / Arch. Doesn't affect Windows build.

I also don't have much experience with using debugging programs. wish me
luck ;D


Reply to this email directly or view it on GitHub
#164 (comment).

@Neugeniko
Copy link
Contributor Author

This is the backtrace from gdb currently. I should be able to get a more python friendly backtrace later this week.

#0  0xb6ec1922 in wxEvtHandler::SearchDynamicEventTable(wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0
#1  0xb6ec1a0b in wxEvtHandler::ProcessEvent(wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0
#2  0xb6ec14f8 in wxEvtHandler::ProcessPendingEvents() () from /usr/lib/libwx_baseu-2.8.so.0
#3  0xb6e30f39 in wxAppConsole::ProcessPendingEvents() () from /usr/lib/libwx_baseu-2.8.so.0
#4  0xb711ef22 in wxAppBase::ProcessIdle() () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#5  0xb70895a2 in ?? () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#6  0xb63bf550 in ?? () from /usr/lib/libglib-2.0.so.0
#7  0xb63c283e in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#8  0xb63c2be8 in ?? () from /usr/lib/libglib-2.0.so.0
#9  0xb63c304b in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#10 0xb69a5d10 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#11 0xb709f9ee in wxEventLoop::Run() () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#12 0xb711ed2f in wxAppBase::MainLoop() () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#13 0xb7615a68 in wxPyApp::MainLoop() () from /usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/_core_.so
#14 0xb764cbcd in ?? () from /usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/_core_.so
#15 0xb7e47e14 in PyCFunction_Call () from /usr/lib/libpython2.7.so.1.0
#16 0xb7eb9da7 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#17 0xb7ebbd70 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#18 0xb7e2d516 in ?? () from /usr/lib/libpython2.7.so.1.0
#19 0xb7df5122 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#20 0xb7e0683e in ?? () from /usr/lib/libpython2.7.so.1.0
#21 0xb7df5122 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#22 0xb7eb64a5 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#23 0xb7ebae65 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#24 0xb7ebbd70 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#25 0xb7ebbe03 in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0
#26 0xb7ee0929 in PyRun_FileExFlags () from /usr/lib/libpython2.7.so.1.0
#27 0xb7ee208f in PyRun_SimpleFileExFlags () from /usr/lib/libpython2.7.so.1.0
#28 0xb7ee25e8 in PyRun_AnyFileExFlags () from /usr/lib/libpython2.7.so.1.0
#29 0xb7ef9526 in Py_Main () from /usr/lib/libpython2.7.so.1.0
#30 0x08048577 in main ()

Neug

@Neugeniko
Copy link
Contributor Author

DeletePage @ page.Destroy() is causing the segmentation fault in chromeTabs.py but only when called from fittingView.py.

SNIP
def DeletePage(self, n, internal = False):
page = self.pages[n]
self.pages.remove(page)
page.Destroy() HERE

@blitzmann
Copy link
Collaborator

Correction. This only happens to me on Ubuntu. Arch handles this fine... odd...

Also found that execution goes to at least d.Display.Destroy(self) in FittingView.Destroy() (which is page.Destroy() in previous comment).

Display.Destroy(self) is not a custom method - it's handled by wx's default widget destroy...

@Neugeniko
Copy link
Contributor Author

I wonder what would happen if you used the /usr/lib/libwx_baseu-2.8.so.0 file from arch on ubuntu?

@DarkFenX
Copy link
Member

DarkFenX commented Sep 9, 2014

For the record - this sometimes happens when you delete fit you're not viewing too.

@blitzmann
Copy link
Collaborator

@DarkFenX "not viewing" meaning it's not loaded at all in the fitting tabs, or it's just not the active one?

I've experimented with it a bit. I think (not certain) it's probably because when you delete the fit, the fit deletes from the database, then the event is fired to remove it from the fitting window. The fitting window probably tries to do something with it upon close, but since it's already been deleted, it dies.

I've had mild success with this:

 gui/shipBrowser.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py
index c928a85..92108ea 100644
--- a/gui/shipBrowser.py
+++ b/gui/shipBrowser.py
@@ -1612,14 +1612,13 @@ class FitItem(SFItem.SFBrowserItem):

         sFit = service.Fit.getInstance()

-        sFit.deleteFit(self.fitID)
+        wx.PostEvent(self.mainFrame, FitRemoved(fitID=self.fitID))

         if self.shipBrowser.GetActiveStage() == 4:
             wx.PostEvent(self.shipBrowser,SearchSelected(text=self.shipBrowser.navpanel.lastSearch,back=True))
         else:
             wx.PostEvent(self.shipBrowser,Stage3Selected(shipID=self.shipID, back=True))
-
-        wx.PostEvent(self.mainFrame, FitRemoved(fitID=self.fitID))
+        sFit.deleteFit(self.fitID)

     def MouseLeftUp(self, event):

Sometimes I'm able to delete the fit without it breaking. However, it still segfaults more often then not. =/

@DarkFenX
Copy link
Member

@blitzmann i meant that it may happen even when no fits are open (just single empty tab).

@blitzmann
Copy link
Collaborator

@Neugeniko have you made any progress in identifying the issue? I remember you stating on the forums that you had a possible answer

@Neugeniko
Copy link
Contributor Author

I've given up on finding a good workaround that could be coded. I'm using
the non ideal method of commenting out the page destroy line in
chrometabs.py that causes the fault.

On Wednesday, November 19, 2014, Ryan Holmes [email protected]
wrote:

@Neugeniko https://github.com/Neugeniko have you made any progress in
identifying the issue? I remember you stating on the forums that you had a
possible answer


Reply to this email directly or view it on GitHub
#164 (comment).

@blitzmann
Copy link
Collaborator

I had a similar issue with a seg fault when destroying wx.ProgressDialog, see: #232

The way I fixed it was a workaround: don't Destroy, instead Hide. There was also a possible work aroud that may work for this issue: insert a small delay before destroying. Sometimes there is still activity in the events queue when you want to destroy, and that causes the seg fault. Adding a small delay might help.

DestroyLater() may also be a thing, however I believe it's only available in Pheonix. https://groups.google.com/forum/#!topic/wxpython-users/fOgc5jdjey8

@ChemicalRascal
Copy link

This crash (though possibly not the exact same one -- regardless, the cause is the same) also appears to occur under Windows 8.1. Or, rather, it does now, given that it wasn't occurring in Sept. 2014.

@blitzmann
Copy link
Collaborator

I'm taking another look at this. If I comment out this bit that actually deletes the fit, it can still crash, so the fit itself deleting doesn't seem to be the cause.

@blitzmann
Copy link
Collaborator

self.mainFrame.Unbind(gui.shipBrowser.EVT_FIT_RENAMED, handler=self.fitRenamed)

in fittingView.py::Destroy() seems to be causing the issue. If I comment it out, I can't reproduce.

I'm starting to think that this is an event issue or collision of some sort. Each fitting view has events attached to it so that it can look for changes. A proper fix would be to have the fitting view only display the modules, and have all the event handing in the parent, the MultiSwitch. That would be proper design, anyway.

@DarkFenX
Copy link
Member

I haven't been getting any issues with this lately. What about other people in this thread?

@DarkFenX
Copy link
Member

DarkFenX commented Oct 2, 2019

Closing, reopen if still applicable.

@DarkFenX DarkFenX closed this as completed Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants