Why do we process the shutdown list if not snapshotting?

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

Re: Why do we process the shutdown list if not snapshotting?

Chris Muller-3
On Mon, Apr 18, 2016 at 11:46 AM, Levente Uzonyi <[hidden email]> wrote:

> On Mon, 18 Apr 2016, Chris Muller wrote:
>
>>> But good practice is to close DB connections when app is closing for
>>> example
>>>
>>>
>>> Agreed. Bug do you agree that #save is not a time to close, whereas
>>> #saveAndQuit and #quit are?
>>
>>
>> Wait, I don't, for the exact reason Denis mentions above.  When I save
>> the image, regardless whether its gonna be shut down, Magma will close
>> down, so that the state of the saved image is not with open files,
>> sockets, etc.
>>
>> On a save-and-resume, it then goes ahead and Re-Opens everythiing.
>> Sure, this forces it to go through its shutdown/startup routine on a
>> save but... so what?  Couldn't your external memory pointers re-init
>> themselves similarly?  What is the goal here, to improve performance
>> of saving the image?
>
>
> I guess it's to avoid the unnecessary downtime.

You mean for a server in production using image persistence?  If so,
is the image saved with those open resources still usable and, if so,
is the expensive shutdown code needed at all then?

Is what we need to just shift our focus to making things right on the
startup side instead of the shutdown side?  I seem to remember, the
folks at... Dolphin or Smalltalk-MT made a good argument for this
philosophy..

Reply | Threaded
Open this post in threaded view
|

Re: Why do we process the shutdown list if not snapshotting?

Chris Muller-3
In reply to this post by marcel.taeumel
See ArchiveViewer class>>#shutDown:.

On Mon, Apr 18, 2016 at 2:37 AM, marcel.taeumel <[hidden email]> wrote:

> Oh, "save and resume" would not delete a temp folder from disk while "save
> and quit" would do so. Hmm... we need both variables.
>
> Best,
> Marcel
>
>
>
> --
> View this message in context: http://forum.world.st/Why-do-we-process-the-shutdown-list-if-not-snapshotting-tp4890384p4890543.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: Why do we process the shutdown list if not snapshotting?

Chris Muller-3
In reply to this post by Eliot Miranda-2
Saving an image in a clean state is still a requirement, but I think
we can still achieve your vision, Eliot, by simply removing the
shutdown code of as many things as we can -- and take care their
things in their startup instead.

As we get more and more of them moved, shutDown: will run faster and
faster, and Save-and-Resume will be instantaneous.

This approach preserves backward compatibility and the requirement
that we be allowed to save-and-resume our images with a valid state.


On Mon, Apr 18, 2016 at 8:00 AM, Eliot Miranda <[hidden email]> wrote:

> Hi Tim, Tobias & Marcel,
>
>> On Apr 18, 2016, at 12:47 AM, timfelgentreff <[hidden email]> wrote:
>>
>> No, you need three variables. Your scenarios are correct, I think, but 1 and
>> 2 need to differentiate. If you're saving and quitting you want to compress
>> forms and remove tmpdirs and such, but if you're saving and keeping the
>> image open you want to skip the tmpdir removal, not close open sockets,
>> maybe only set a variable for startup to re-init that stuff...
>
> Ok so perhaps there are three states, but that doesn't imply three variables.  One would suffice if a symbol were used: #quit #save #saveAndQuit.
>
> But is it feasible to ignore #save and expect startUp: to deal with the deferred clean up?  #save is not, and usefully /should not/ be a shut down.  To exit the system, any save must be followed by either a #quit or a #saveAndQuit.  So IMO #save should not shutDown:.  Here are two motivating examples
>
> 1. Use of #save to produce a checkpoint, or produce an image to debug some issue at a later date.  In this case the image should be as close to the running image as possible.  Not shutting down in #save is required here.
>
> 2. Cleaning up C pointers.  It is common enough for applications to allocate external memory and refer to it through pointer objects (IIRC, Alien & ExternalAddress in Squeak et al, CPointer in VW).  These /cannot/ be released on #save, because doing so would force shutting down of external code that is using that memory.  So instead very early on startUp: all such referents are visited (eg via allInstances, or by enumerating a weak set) and their references are nilled (since the memory is released implicitly on #quit).
>
> So IMO #save should /not/ run either the shutdown list or the startup list in the saving image, and should only run the startup list in the new resuming image.
>
> This may require sophistication on behalf of the programmer, but the start up and shut down lists are indeed nontrivial things to program; they're often maintaining critical infrastructure such as the delay system, and total ordering is extremely important.  Good comments can help.
>
> If you look at VW, you'll see use of pragmas to provide better plug fabulist in terms of providing a priority for ordering, and IIRC for prerequisites.  We could consider a similar approach.
>
>
> _,,,^..^,,,_ (phone)
> Eliot
>
>> marcel.taeumel wrote
>>> Hi there,
>>>
>>> there are three different scenarios for shutdown:
>>>
>>> 1. Save and resume
>>> 2. Save and quit
>>> 3. Quit only
>>>
>>> For general clean-up routines, 1 and 2 should clean-up, while 3 does not
>>> have to. So, one variable might be sufficient. :-)
>>>
>>> Any other ways of using shutdown?
>>>
>>> Best,
>>> Marcel
>>
>>
>> --
>> View this message in context: http://forum.world.st/Why-do-we-process-the-shutdown-list-if-not-snapshotting-tp4890384p4890547.html
>> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>>
>

12