You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Rob Walker <ro...@ascert.com> on 2007/09/10 17:46:25 UTC

Anyone had issues with subsequent Framework creation & start in single Applet VM lifecycle

Hitting an odd scenario.

When I start my Applet based Felix it works fine first time.

But if I do a shutdown (by a stop() on Bundle 0) and then attempt to 
create a new Felix instance and call start() on it, my startup seems to 
freeze.

More specifically, I don't seem to get any bundle or framework start 
events being fired.

If I use the Java Applet Console to clear the classloader cache (by 
hitting 'x') - bingo - I can start a new framework.

This reminds me of other Applet VM cases where statics persisted across 
Applet starts and messed up starting new/additional instances.

Wondering if anyone else has come across any issues with attempting to 
create and start a new Felix instance in an existing VM, after a 
previous Felix instance has been shutdown?

Wondering if I am missing some "golden rule" for the right way to start 
multiple Felix instances within the lifespan of a single VM?

Regards

-- Rob


Ascert - Taking systems to the Edge
robw@ascert.com
+44 (0)20 7488 3470
www.ascert.com


Re: Anyone had issues with subsequent Framework creation & start in single Applet VM lifecycle

Posted by Karl Pauls <ka...@gmail.com>.
> Rob,
>
> this sounds strange indeed. Could you give a little more information
> e.g., are you running on trunk now?
>
> I just tried to create an example for me and I do see that felix is
> freezing but only until I hit enter twice in the shell. Then I see a
> NoClassDefFoundError and after that everything runs just fine again...
> Very strange.

O.k., I figured out what is going wrong in my example but it is not
related to your problem. The NoClassDefFoundError is actually related
to the shell and in this case correct.

Sorry about the noise.

regards,

Karl

> regards,
>
> Karl
>
> On 9/10/07, Rob Walker <ro...@ascert.com> wrote:
> > Hitting an odd scenario.
> >
> > When I start my Applet based Felix it works fine first time.
> >
> > But if I do a shutdown (by a stop() on Bundle 0) and then attempt to
> > create a new Felix instance and call start() on it, my startup seems to
> > freeze.
> >
> > More specifically, I don't seem to get any bundle or framework start
> > events being fired.
> >
> > If I use the Java Applet Console to clear the classloader cache (by
> > hitting 'x') - bingo - I can start a new framework.
> >
> > This reminds me of other Applet VM cases where statics persisted across
> > Applet starts and messed up starting new/additional instances.
> >
> > Wondering if anyone else has come across any issues with attempting to
> > create and start a new Felix instance in an existing VM, after a
> > previous Felix instance has been shutdown?
> >
> > Wondering if I am missing some "golden rule" for the right way to start
> > multiple Felix instances within the lifespan of a single VM?
> >
> > Regards
> >
> > -- Rob
> >
> >
> > Ascert - Taking systems to the Edge
> > robw@ascert.com
> > +44 (0)20 7488 3470
> > www.ascert.com
> >
> >
>
>
> --
> Karl Pauls
> karlpauls@gmail.com
>


-- 
Karl Pauls
karlpauls@gmail.com

Re: Anyone had issues with subsequent Framework creation & start in single Applet VM lifecycle

Posted by Karl Pauls <ka...@gmail.com>.
Rob,

this sounds strange indeed. Could you give a little more information
e.g., are you running on trunk now?

I just tried to create an example for me and I do see that felix is
freezing but only until I hit enter twice in the shell. Then I see a
NoClassDefFoundError and after that everything runs just fine again...
Very strange.

regards,

Karl

On 9/10/07, Rob Walker <ro...@ascert.com> wrote:
> Hitting an odd scenario.
>
> When I start my Applet based Felix it works fine first time.
>
> But if I do a shutdown (by a stop() on Bundle 0) and then attempt to
> create a new Felix instance and call start() on it, my startup seems to
> freeze.
>
> More specifically, I don't seem to get any bundle or framework start
> events being fired.
>
> If I use the Java Applet Console to clear the classloader cache (by
> hitting 'x') - bingo - I can start a new framework.
>
> This reminds me of other Applet VM cases where statics persisted across
> Applet starts and messed up starting new/additional instances.
>
> Wondering if anyone else has come across any issues with attempting to
> create and start a new Felix instance in an existing VM, after a
> previous Felix instance has been shutdown?
>
> Wondering if I am missing some "golden rule" for the right way to start
> multiple Felix instances within the lifespan of a single VM?
>
> Regards
>
> -- Rob
>
>
> Ascert - Taking systems to the Edge
> robw@ascert.com
> +44 (0)20 7488 3470
> www.ascert.com
>
>


-- 
Karl Pauls
karlpauls@gmail.com

Re: Raised and submitted fix under FELIX-363 for this [Re: Anyone had issues with subsequent Framework creation & start in single Applet VM lifecycle]

Posted by Rob Walker <ro...@ascert.com>.
Yep - taxed my overworked brain a shade chasing this one down.

I'm stll having 1 or 2 Applet based instance issues - but I think 
they're now within our application code.

If I do find any other boundary cases along these lines I'll re-commit 
any extra mods needed

-- Rob

Richard S. Hall wrote:
> Interesting, thanks Rob!
>
> -> richard


Re: Raised and submitted fix under FELIX-363 for this [Re: Anyone had issues with subsequent Framework creation & start in single Applet VM lifecycle]

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Interesting, thanks Rob!

-> richard

Rob Walker wrote:
> Seems my hunch was correct, and that an Applet VM can kill or cause 
> death of global EventDispatcher thread preventing further Felix 
> instance launches within the same browser session.
>
> Have raised and committed a fix for this under FELIX-363
>
> -- Rob
>
> Rob Walker wrote:
>>> Richard S. Hall wrote:
>>>> On a older version of the trunk we had a bug where the global event 
>>>> thread was being killed between successive instance of Felix...are 
>>>> you on 1.0.0 or on trunk?
>>>>
>> I have a hunch this may be a subtle *nasty* variation on the scenario 
>> FELIX-314 fixes.
>>
>> The following code is the actual dispatcher thread itself:
>>
>>            // Start event dispatching thread if necessary.
>>            if (m_thread == null)
>>            {
>>                m_thread = new Thread(new Runnable() {
>>                    public void run()
>>                    {
>>                        EventDispatcher.run();
>>                    }
>>                }, "FelixDispatchQueue");
>>                m_thread.start();
>>            }
>>
>> FELIX-341 has put safety code in to ensure that thread isn't killed 
>> if there is still a +ve usage count.
>>
>> However - if the thread "dies" or is killed by some external cause 
>> then I think we can get a scenario where m_thread != null , but the 
>> thread has ended.
>>
>> I suspect - in my Applet based environment. The VM managed by the 
>> browser is actually forcable killing any remaining threads - so 
>> although the internal Felix state shows this thread as still running, 
>> it has in fact been killed by the VM.
>>
>> I'll do some experimentation and see if I can prove if this is what 
>> is causing the issue we're seeing here
>>
>> Regards
>>
>> -- Rob
>

Raised and submitted fix under FELIX-363 for this [Re: Anyone had issues with subsequent Framework creation & start in single Applet VM lifecycle]

Posted by Rob Walker <ro...@ascert.com>.
Seems my hunch was correct, and that an Applet VM can kill or cause 
death of global EventDispatcher thread preventing further Felix instance 
launches within the same browser session.

Have raised and committed a fix for this under FELIX-363

-- Rob

Rob Walker wrote:
>> Richard S. Hall wrote:
>>> On a older version of the trunk we had a bug where the global event 
>>> thread was being killed between successive instance of Felix...are 
>>> you on 1.0.0 or on trunk?
>>>
> I have a hunch this may be a subtle *nasty* variation on the scenario 
> FELIX-314 fixes.
>
> The following code is the actual dispatcher thread itself:
>
>            // Start event dispatching thread if necessary.
>            if (m_thread == null)
>            {
>                m_thread = new Thread(new Runnable() {
>                    public void run()
>                    {
>                        EventDispatcher.run();
>                    }
>                }, "FelixDispatchQueue");
>                m_thread.start();
>            }
>
> FELIX-341 has put safety code in to ensure that thread isn't killed if 
> there is still a +ve usage count.
>
> However - if the thread "dies" or is killed by some external cause 
> then I think we can get a scenario where m_thread != null , but the 
> thread has ended.
>
> I suspect - in my Applet based environment. The VM managed by the 
> browser is actually forcable killing any remaining threads - so 
> although the internal Felix state shows this thread as still running, 
> it has in fact been killed by the VM.
>
> I'll do some experimentation and see if I can prove if this is what is 
> causing the issue we're seeing here
>
> Regards
>
> -- Rob


Re: Anyone had issues with subsequent Framework creation & start in single Applet VM lifecycle

Posted by Rob Walker <ro...@ascert.com>.
I *think* we updated to trunk as of mid last week - although I'll double 
check, because this does sound spookily like the scenario we're seeing.
Thanks
-- Rob

Richard S. Hall wrote:
> On a older version of the trunk we had a bug where the global event 
> thread was being killed between successive instance of Felix...are you 
> on 1.0.0 or on trunk?
>
> -> richard
>
> Rob Walker wrote:
>> Hitting an odd scenario.
>>
>> When I start my Applet based Felix it works fine first time.
>>
>> But if I do a shutdown (by a stop() on Bundle 0) and then attempt to 
>> create a new Felix instance and call start() on it, my startup seems 
>> to freeze.
>>
>> More specifically, I don't seem to get any bundle or framework start 
>> events being fired.
>>
>> If I use the Java Applet Console to clear the classloader cache (by 
>> hitting 'x') - bingo - I can start a new framework.
>>
>> This reminds me of other Applet VM cases where statics persisted 
>> across Applet starts and messed up starting new/additional instances.
>>
>> Wondering if anyone else has come across any issues with attempting 
>> to create and start a new Felix instance in an existing VM, after a 
>> previous Felix instance has been shutdown?
>>
>> Wondering if I am missing some "golden rule" for the right way to 
>> start multiple Felix instances within the lifespan of a single VM?
>>
>> Regards
>>
>> -- Rob
>>
>>
>> Ascert - Taking systems to the Edge
>> robw@ascert.com
>> +44 (0)20 7488 3470
>> www.ascert.com
>>

-- 


Ascert - Taking systems to the Edge
robw@ascert.com
+44 (0)20 7488 3470
www.ascert.com


Re: Anyone had issues with subsequent Framework creation & start in single Applet VM lifecycle

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On a older version of the trunk we had a bug where the global event 
thread was being killed between successive instance of Felix...are you 
on 1.0.0 or on trunk?

-> richard

Rob Walker wrote:
> Hitting an odd scenario.
>
> When I start my Applet based Felix it works fine first time.
>
> But if I do a shutdown (by a stop() on Bundle 0) and then attempt to 
> create a new Felix instance and call start() on it, my startup seems 
> to freeze.
>
> More specifically, I don't seem to get any bundle or framework start 
> events being fired.
>
> If I use the Java Applet Console to clear the classloader cache (by 
> hitting 'x') - bingo - I can start a new framework.
>
> This reminds me of other Applet VM cases where statics persisted 
> across Applet starts and messed up starting new/additional instances.
>
> Wondering if anyone else has come across any issues with attempting to 
> create and start a new Felix instance in an existing VM, after a 
> previous Felix instance has been shutdown?
>
> Wondering if I am missing some "golden rule" for the right way to 
> start multiple Felix instances within the lifespan of a single VM?
>
> Regards
>
> -- Rob
>
>
> Ascert - Taking systems to the Edge
> robw@ascert.com
> +44 (0)20 7488 3470
> www.ascert.com
>