Thread: [Orbit-python-list] Crash with ORB_init() / del() in 0.3.1
Status: Inactive
Brought to you by:
tack
From: Christian R. R. <ki...@as...> - 2001-11-15 14:11:48
|
The following snippet (thanks zilch) illustrates a cool undiscovered-as-of-yet crash in ORBit-Python with both ORBit-0.5.8 and 0.5.12: import CORBA for o in range(0,4): orb = CORBA.ORB_init() del(orb) As always I am finding these neat new ways to crash o-p. This time, what happens was discussed on #gnome: <kiko> hmmm I think I know what it is. <kiko> this crash happens when I have multiple orb = ORB_init() + del(orb) calls <kiko> which means I am releasing the orb, recreating it, and releasing it again. does that work? <markmc> kiko, I think in ORBit, ORBit_init didn't do a CORBA_Object_duplicate on the existing ORB before returning it, so you would only be allowed to release it once <kiko> hmmm. i'll have to work around this to avoid a crash in the testsuite. <markmc> kiko, I remember Michael talking about this recently.... <markmc> kiko, its different in ORBit2 <kiko> markmc: I see. I'll put this on the ML to see what Tack says. <markmc> kiko, but we didn't want to introduce leaks into old ORBit progs by changing the behaviour <kiko> Hmmmm. I understand. So I think we're not allowed to create the orb multiple times. To work around this, there are a couple of solutions I see: a) Make the ORB a special object, so it's release is just a dummy release and it only gets cleaned up by Python on exit (no big deal IMHO but this isn't really fixing it). b) Make PyObject release check if it's an orb and if so, don't release it. We would have to change ORB_init() to not really create two orbs if we didn't want to leak, of course. Well, Tack, opinion? I haven't looked at the ORBit code, but I'll do so now. Oh, I also fixed PACKAGE=orbiit-python in configure.in and configure that SOMEBODY checked into the tree this week. Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL |
From: Jason T. <ta...@au...> - 2001-11-15 14:30:24
|
> <markmc> kiko, I think in ORBit, ORBit_init didn't do a > CORBA_Object_duplicate on the existing ORB before returning it, so you > would only be allowed to release it once This is the problem. So, as we discussed on IRC, add the CORBA_Object_duplicate call to CORBA_ORB_PyObject__new and leave the CORBA_Object_release call in the destructor. This is better than just removing CORBA_Object_release() since it's more consistent with refcounting. (i.e. we grab a ref to the ORB in the constructor and release the reference in the destructor, as opposed to borrowing the ref from ORBit.) > <markmc> kiko, I remember Michael talking about this recently.... > <markmc> kiko, its different in ORBit2 Keep that in mind, Johan. :) > a) Make the ORB a special object, so it's release is just a dummy release > and it only gets cleaned up by Python on exit (no big deal IMHO but this > isn't really fixing it). The ORB is already a separate type object. So the fix is trivial. Jason. -- Academic Computing Support Specialist Assistant Section Editor Algoma University College http://linux.com/develop Sault Ste. Marie, Ontario 705-949-2301 x330 Personal Home Page http://www.auc.ca http://sault.org |
From: Johan D. <jd...@te...> - 2001-11-15 16:41:19
|
tor 2001-11-15 klockan 15.23 skrev Jason Tackaberry: > > <markmc> kiko, I think in ORBit, ORBit_init didn't do a > > CORBA_Object_duplicate on the existing ORB before returning it, so you > > would only be allowed to release it once > > This is the problem. > > So, as we discussed on IRC, add the CORBA_Object_duplicate call to > CORBA_ORB_PyObject__new and leave the CORBA_Object_release call in the > destructor. This is better than just removing CORBA_Object_release() > since it's more consistent with refcounting. (i.e. we grab a ref to the > ORB in the constructor and release the reference in the destructor, as > opposed to borrowing the ref from ORBit.) > > > <markmc> kiko, I remember Michael talking about this recently.... > > <markmc> kiko, its different in ORBit2 > > Keep that in mind, Johan. :) > > > a) Make the ORB a special object, so it's release is just a dummy release > > and it only gets cleaned up by Python on exit (no big deal IMHO but this > > isn't really fixing it). > > The ORB is already a separate type object. So the fix is trivial. > > Jason. > > -- > Academic Computing Support Specialist Assistant Section Editor > Algoma University College http://linux.com/develop > Sault Ste. Marie, Ontario > 705-949-2301 x330 Personal Home Page > http://www.auc.ca http://sault.org > > > _______________________________________________ > Orbit-python-list mailing list > Orb...@li... > https://lists.sourceforge.net/lists/listinfo/orbit-python-list >>> import CORBA >>> for i in range (50): ... orb = CORBA.ORB_init () ... del orb ... Works perfectly in ORBit2 port. (without duplicating the orb) --- Johan Dahlin |