Fernando Perez wrote: > Howdy, > > On Jan 8, 2008 10:43 AM, mabshoff > <[EMAIL PROTECTED]> wrote: > >> Ok, the culprit points to a cleanup function of m4ri, which under >> normal conditions is called only once. I am not seeing the above issue >> under valgrdind with "pure" Sage 2.10.alpha0, but as I just learned >> yesterday problematic free() calls might be hidden by other bugs. >> Imagine my surprise that once I fixed #1092 or #1093 some invalid free >> popped up. We currently have a problem in tp_new (see #1337) which is >> the only culprit on our end that could hide that. But the question >> remains if IPython does something funny with threads and somehow >> triggers more than one cleanup call. We could add some check for NULL >> inside destroyAllCodes(). So, anybody with a better knowledge of >> IPython: It seems that threads are involved, so could this somehow be >> triggered? > > Sorry for the slow reply. Bit swamped 'round here... > > Yes, the issue is really that I explained myself poorly to Jaap. He's running > > import IPython > IPython.Shell.IPShellWX().mainloop() > > Inside an already started Sage session. But at the exit of that > mainloop(), ipython will tear down the threading support (absolutely > necessary for WX to work without blocking the interactive console). > That mainloop is hooked into the WX event loop, so it can't really be > restarted. > > The solution is to have Sage start ipython with the wthread option, if > you want full Sage support. As a starter, you can test this. Make a > little file that's simply > > #!/path/to/sage/python > import IPython > IPython.Shell.IPShellWX().mainloop() > > > make it executable, and run it *standalone* in a sage-sh configured > shell. This standalone ipython is equivalent to running > > ipython -wthread > > and will simply exit at the end. If that works and closes without > crashing, then someone more familiar than myself with how sage starts > itself can then offer an option for sage to fire up ipython with > '-wthread' at startup. This will ensure that the threads cleanup only > happens when sage itself exits, not in the middle of the enclosing > Sage session. >
This worked for me! > My originally incomplete explanation led Jaap to have a main event > loop inside another one. That's always bad news. > > I hope this is now clearer. > Thanks! Jaap > Cheers, > > f > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---