Zinc adaptor zombie

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Zinc adaptor zombie

EstebanLM
Hi,

look at this code:

ZnZincServerAdaptor>>#server
        "Return the ZnServer running me, create a default one if missing"
       
        ^ server ifNil: [ server := self defaultZnServer ].


...and...

ZnZincServerAdaptor>>#startUp
        self server isNil
                ifFalse: [ self server start ]

so... this will stay alive for ever... even if you try to kill him with a shotgun (and yes... is a brain eater) :)

Esteban

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Zinc adaptor zombie

Sven Van Caekenberghe
Esteban,

On 01 Jul 2012, at 11:19, Esteban Lorenzano wrote:

> Hi Sven,
>
> no... problem is that
>
> 1) you create a server with zinc adaptor
> 2) you need to change it to use comanche, then you stop one, start the other [1].
> 3) when you save image, ZnServer is restarted anyway.

OK, I understand now and I could reproduce it.

But this is a Seaside issue/feature: WAServerManager will send #startUp to all its adaptors, regardless whether they were stopped manually or not, it wants them all to be running after a restart.

I think that sending #unregister to an adaptor would be the behavior you are looking for.

When WAServerManager sends #startUp to a stopped ZnZincServerAdaptor things go wrong (essentially #basicStart is needed), indeed. Thanks for pointing that out, I added some changes to Zinc-Seaside so that the lazy initialization in #server is not called unnecessary.

==================== Summary ====================

Name: Zinc-Seaside-SvenVanCaekenberghe.31
Author: SvenVanCaekenberghe
Time: 2 July 2012, 1:55:58 pm
UUID: 540e70b1-fd93-42d8-b05b-18f15c9ae5b4
Ancestors: Zinc-Seaside-PaulDeBruicker.30

bring some sanity to how #server lazy initialization was handled;
changed semantics of #startUp to do a #basicStart when the server was stopped

=================================================

Sven

> [1] My *real* problem is that I cannot use Zinc Adaptor in certain cases: When I use seaside rest to do a put, rawBody is always empty.

That should normally work, as far as I know. Could you provided more information, preferrably a use case against one of the test handlers ?

Thx.

> best,
> Esteban
>
> On Jul 1, 2012, at 11:07 AM, Sven Van Caekenberghe wrote:
>
>> Hi Esteban,
>>
>> On 01 Jul 2012, at 10:38, Esteban Lorenzano wrote:
>>
>>> Hi,
>>>
>>> look at this code:
>>>
>>> ZnZincServerAdaptor>>#server
>>> "Return the ZnServer running me, create a default one if missing"
>>>
>>> ^ server ifNil: [ server := self defaultZnServer ].
>>>
>>>
>>> ...and...
>>>
>>> ZnZincServerAdaptor>>#startUp
>>> self server isNil
>>> ifFalse: [ self server start ]
>>>
>>> so... this will stay alive for ever... even if you try to kill him with a shotgun (and yes... is a brain eater) :)
>>>
>>> Esteban
>>
>> I am not sure I understand the question here.
>> AFAIK, the lifecycle of a Seaside adaptor is controlled by the manager, not the instance itself.
>> When you first create an adaptor it will only lazily create the server and then start it.
>> When you stop an adaptor, the Zn server will stop, but indeed the instance stays put, which should not be a problem.
>> There is always the option to remove the adaptor from the manager, and everything should become garbage, no ?
>>
>> Sven
>>
>>
>> --
>> Sven Van Caekenberghe
>> http://stfx.eu
>> Smalltalk is the Red Pill
>>
>

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Zinc adaptor zombie

Julian Fitzell-2
On Mon, Jul 2, 2012 at 12:58 PM, Sven Van Caekenberghe <[hidden email]> wrote:

>
> Esteban,
>
> On 01 Jul 2012, at 11:19, Esteban Lorenzano wrote:
>
> > Hi Sven,
> >
> > no... problem is that
> >
> > 1) you create a server with zinc adaptor
> > 2) you need to change it to use comanche, then you stop one, start the other [1].
> > 3) when you save image, ZnServer is restarted anyway.
>
> OK, I understand now and I could reproduce it.
>
> But this is a Seaside issue/feature: WAServerManager will send #startUp to all its adaptors, regardless whether they were stopped manually or not, it wants them all to be running after a restart.

#startUp is not supposed to start the server. #startUp is the message
sent to notify of image startup. You can implement it to do
initialization if needed (take a look at WAListenerAdaptor in the
command adaptor package, for example, which uses it to reinitialize a
Proces, *but only if the adaptor was running when the image was
saved*).

Many adaptors do not need to implement #startUp, but if you do, you
should not start up unless you were running on image save.

Julian
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Zinc adaptor zombie

Julian Fitzell-2
On Mon, Jul 2, 2012 at 4:29 PM, Julian Fitzell <[hidden email]> wrote:
> command adaptor package

*comanche* adaptor package
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Zinc adaptor zombie

Sven Van Caekenberghe
In reply to this post by Julian Fitzell-2
On 02 Jul 2012, at 17:29, Julian Fitzell wrote:

> On Mon, Jul 2, 2012 at 12:58 PM, Sven Van Caekenberghe <[hidden email]> wrote:
>>
>> Esteban,
>>
>> On 01 Jul 2012, at 11:19, Esteban Lorenzano wrote:
>>
>>> Hi Sven,
>>>
>>> no... problem is that
>>>
>>> 1) you create a server with zinc adaptor
>>> 2) you need to change it to use comanche, then you stop one, start the other [1].
>>> 3) when you save image, ZnServer is restarted anyway.
>>
>> OK, I understand now and I could reproduce it.
>>
>> But this is a Seaside issue/feature: WAServerManager will send #startUp to all its adaptors, regardless whether they were stopped manually or not, it wants them all to be running after a restart.
>
> #startUp is not supposed to start the server. #startUp is the message
> sent to notify of image startup. You can implement it to do
> initialization if needed (take a look at WAListenerAdaptor in the
> command adaptor package, for example, which uses it to reinitialize a
> Proces, *but only if the adaptor was running when the image was
> saved*).
>
> Many adaptors do not need to implement #startUp, but if you do, you
> should not start up unless you were running on image save.
>
> Julian

That is clear, thanks for explaining.

==================== Summary ====================

Name: Zinc-Seaside-SvenVanCaekenberghe.32
Author: SvenVanCaekenberghe
Time: 2 July 2012, 6:43:41 pm
UUID: b279c0ac-88d6-4ee9-9885-786a90bc2628
Ancestors: Zinc-Seaside-SvenVanCaekenberghe.31

changed ZnZincServerAdaptor>>#startUp not to do a basicStart and the create and start a new server when there is no server (i.e. when the adaptor was previously stopped) [Thx Julian Fitzell for explaining the semantics]

=================================================

Sven

--
Sven Van Caekenberghe
http://stfx.eu
Smalltalk is the Red Pill



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside