[vwnc] Subsystem activation ordering

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

[vwnc] Subsystem activation ordering

Randy Coulman
We just ran into a very interesting problem in our system related to Subsystem activation ordering.  When starting our system, we use -filein to file in a script that loads all of our parcels and launches our system.  One of the parcels we load is CairoGraphics, which has its own Subsystem class.  That Subsystem class will, when activated, flush all of the known handles to Cairo objects.  This is a good thing.

However, given the way we're starting our system, the Cairo system doesn't activate until well after our UI is up and running (and displaying various objects that were rendered with Cairo).  We have been caching some ImageSurfaces, for example (which we may or may not need to do), and these blow up because their handles get flushed out from under them.

I'm not sure if this is really a bug in VW itself, but I wanted to raise the issue in case other people run into similar problems.  Even splitting our startup into two phases, a -pcl to load the code and a -filein to launch the system, didn't resolve the issue (probably because both -pcl and -filein are processed by ImageConfigurationSystem).  Instead, we introduced our own Subsystem that does the same thing as -filein, but that pre-reqs CairoSystem.  So, the -pcl to load the code loads our Subsystem, and then it (and Cairo) gets activated before processing its own command-line args.  This solves our problem.

However, the more general question about Subsystem activation timing and ordering remains.

Thoughts?

Randy
--
Randy Coulman
[hidden email]
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Subsystem activation ordering

Steven Kelly

Hi Randy,

 

I’m not sure if this is related, but it’s certainly something to be aware of:

 

From: "Steven Kelly" <[hidden email]>

To: [hidden email]

Date: Wed, 10 Oct 2007

I think there's actually a bug in the interaction between WindowManager process creation, the RTP startup command, and command-line processing handled by application #returnFromSnapshot code. Any windows opened by the RTP startup command or command-line processing will each open in their own WindowManager, each with its own process at priority 50 …”

see the full message for more details about the various processes, ordering and parallelism:

http://www.parcplace.net/list/vwnc-archive/0710/msg00051.html

 

Alan Knight created AR 53071 for this.

 

HTH,

Steve

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Randy Coulman
Sent: 15. huhtikuuta 2008 20:15
To: vwnc
Subject: [vwnc] Subsystem activation ordering

 

We just ran into a very interesting problem in our system related to Subsystem activation ordering.  When starting our system, we use -filein to file in a script that loads all of our parcels and launches our system.  One of the parcels we load is CairoGraphics, which has its own Subsystem class.  That Subsystem class will, when activated, flush all of the known handles to Cairo objects.  This is a good thing.

However, given the way we're starting our system, the Cairo system doesn't activate until well after our UI is up and running (and displaying various objects that were rendered with Cairo).  We have been caching some ImageSurfaces, for example (which we may or may not need to do), and these blow up because their handles get flushed out from under them.

I'm not sure if this is really a bug in VW itself, but I wanted to raise the issue in case other people run into similar problems.  Even splitting our startup into two phases, a -pcl to load the code and a -filein to launch the system, didn't resolve the issue (probably because both -pcl and -filein are processed by ImageConfigurationSystem).  Instead, we introduced our own Subsystem that does the same thing as -filein, but that pre-reqs CairoSystem.  So, the -pcl to load the code loads our Subsystem, and then it (and Cairo) gets activated before processing its own command-line args.  This solves our problem.

However, the more general question about Subsystem activation timing and ordering remains.

Thoughts?

Randy
--
Randy Coulman
[hidden email]


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Subsystem activation ordering

Alan Knight-2
In reply to this post by Randy Coulman
When you're loading code that contains a subsystem, that subsystem will activate after loading. Which, if you've got a subsystem that does those sorts of things, is probably inappropriate.

The thing that occurs to me off the top of my head is to put a check in the subsystem activation not to do it if we're past, say, early system installation, by checking if some subsystem that you'd normally expect to be after you has run. Finalization is probably a reasonable choice.

At 01:14 PM 4/15/2008, Randy Coulman wrote:
We just ran into a very interesting problem in our system related to Subsystem activation ordering.  When starting our system, we use -filein to file in a script that loads all of our parcels and launches our system.  One of the parcels we load is CairoGraphics, which has its own Subsystem class.  That Subsystem class will, when activated, flush all of the known handles to Cairo objects.  This is a good thing.

However, given the way we're starting our system, the Cairo system doesn't activate until well after our UI is up and running (and displaying various objects that were rendered with Cairo).  We have been caching some ImageSurfaces, for example (which we may or may not need to do), and these blow up because their handles get flushed out from under them.

I'm not sure if this is really a bug in VW itself, but I wanted to raise the issue in case other people run into similar problems.  Even splitting our startup into two phases, a -pcl to load the code and a -filein to launch the system, didn't resolve the issue (probably because both -pcl and -filein are processed by ImageConfigurationSystem).  Instead, we introduced our own Subsystem that does the same thing as -filein, but that pre-reqs CairoSystem.  So, the -pcl to load the code loads our Subsystem, and then it (and Cairo) gets activated before processing its own command-line args.  This solves our problem.

However, the more general question about Subsystem activation timing and ordering remains.

Thoughts?

Randy
--
Randy Coulman
[hidden email]
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

--
Alan Knight [|], Engineering Manager, Cincom Smalltalk

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Subsystem activation ordering

Alan Knight-2
Actually, an alternate might be to override postLoad: for the subsystem to make it initialize immediately on load, and thus presumably before your code starts doing anything with Cairo object.

At 06:15 PM 4/16/2008, Alan Knight wrote:
When you're loading code that contains a subsystem, that subsystem will activate after loading. Which, if you've got a subsystem that does those sorts of things, is probably inappropriate.

The thing that occurs to me off the top of my head is to put a check in the subsystem activation not to do it if we're past, say, early system installation, by checking if some subsystem that you'd normally expect to be after you has run. Finalization is probably a reasonable choice.

At 01:14 PM 4/15/2008, Randy Coulman wrote:
We just ran into a very interesting problem in our system related to Subsystem activation ordering.  When starting our system, we use -filein to file in a script that loads all of our parcels and launches our system.  One of the parcels we load is CairoGraphics, which has its own Subsystem class.  That Subsystem class will, when activated, flush all of the known handles to Cairo objects.  This is a good thing.

However, given the way we're starting our system, the Cairo system doesn't activate until well after our UI is up and running (and displaying various objects that were rendered with Cairo).  We have been caching some ImageSurfaces, for example (which we may or may not need to do), and these blow up because their handles get flushed out from under them.

I'm not sure if this is really a bug in VW itself, but I wanted to raise the issue in case other people run into similar problems.  Even splitting our startup into two phases, a -pcl to load the code and a -filein to launch the system, didn't resolve the issue (probably because both -pcl and -filein are processed by ImageConfigurationSystem).  Instead, we introduced our own Subsystem that does the same thing as -filein, but that pre-reqs CairoSystem.  So, the -pcl to load the code loads our Subsystem, and then it (and Cairo) gets activated before processing its own command-line args.  This solves our problem.

However, the more general question about Subsystem activation timing and ordering remains.

Thoughts?

Randy
--
Randy Coulman
[hidden email]
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

--
Alan Knight [|], Engineering Manager, Cincom Smalltalk
[hidden email]
[hidden email]
http://www.cincom.com/smalltalk
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

--
Alan Knight [|], Engineering Manager, Cincom Smalltalk

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Subsystem activation ordering

Travis Griggs-3
On Apr 16, 2008, at 6:25 PM, Alan Knight wrote:

> Actually, an alternate might be to override postLoad: for the  
> subsystem to make it initialize immediately on load, and thus  
> presumably before your code starts doing anything with Cairo object.
>
> At 06:15 PM 4/16/2008, Alan Knight wrote:
>> When you're loading code that contains a subsystem, that subsystem  
>> will activate after loading. Which, if you've got a subsystem that  
>> does those sorts of things, is probably inappropriate.
>>
>> The thing that occurs to me off the top of my head is to put a  
>> check in the subsystem activation not to do it if we're past, say,  
>> early system installation, by checking if some subsystem that you'd  
>> normally expect to be after you has run. Finalization is probably a  
>> reasonable choice.
>>
>> At 01:14 PM 4/15/2008, Randy Coulman wrote:
>>> We just ran into a very interesting problem in our system related  
>>> to Subsystem activation ordering.  When starting our system, we  
>>> use -filein to file in a script that loads all of our parcels and  
>>> launches our system.  One of the parcels we load is CairoGraphics,  
>>> which has its own Subsystem class.  That Subsystem class will,  
>>> when activated, flush all of the known handles to Cairo objects.  
>>> This is a good thing.
>>>
>>> However, given the way we're starting our system, the Cairo system  
>>> doesn't activate until well after our UI is up and running (and  
>>> displaying various objects that were rendered with Cairo).  We  
>>> have been caching some ImageSurfaces, for example (which we may or  
>>> may not need to do), and these blow up because their handles get  
>>> flushed out from under them.
>>>
>>> I'm not sure if this is really a bug in VW itself, but I wanted to  
>>> raise the issue in case other people run into similar problems.  
>>> Even splitting our startup into two phases, a -pcl to load the  
>>> code and a -filein to launch the system, didn't resolve the issue  
>>> (probably because both -pcl and -filein are processed by  
>>> ImageConfigurationSystem).  Instead, we introduced our own  
>>> Subsystem that does the same thing as -filein, but that pre-reqs  
>>> CairoSystem.  So, the -pcl to load the code loads our Subsystem,  
>>> and then it (and Cairo) gets activated before processing its own  
>>> command-line args.  This solves our problem.
>>>
>>> However, the more general question about Subsystem activation  
>>> timing and ordering remains.


That loading activates subsystems seems... odd to me. Because it's  
ambiguous. System restore (early/late) are specific events. And  
loading is an entirely different event that may come at any time. And  
we have the postLoad mechanisms to deal with it. So colluding the two  
seems like we're going to run into this kind of confusion. OTOH, I  
recognize that often the events have the same effect, so it is  
tempting to have a load do an activation.

--
Travis Griggs
Objologist
10 2 letter words: "If it is to be, it is up to me"


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Subsystem activation ordering

Randy Coulman
In reply to this post by Randy Coulman
I wanted to follow one thread you raised (see below)...

On Wed, Apr 16, 2008 at 3:15 PM, Alan Knight <[hidden email]> wrote:
When you're loading code that contains a subsystem, that subsystem will activate after loading. Which, if you've got a subsystem that does those sorts of things, is probably inappropriate.

You say here that the subsystem will "activate after loading".  How soon after loading?  Immediately?

What I was seeing with Cairo here is that the CairoSystem wasn't being activated until after the -filein was completely finished.  Even when I split the load off into a -pcl followed by the -filein to do the rest of the work, CairoSystem wasn't being activated until after the -filein.

It seems to me that the activation of newly-loaded Subsystems isn't actually happening until the currently activating Subsystem (ImageConfigurationSystem in this case) is finished.  I can't tell if this is correct behavior or not.

Randy
--
Randy Coulman
[hidden email]
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Subsystem activation ordering

Alan Knight-2
At 11:09 AM 4/17/2008, Randy Coulman wrote:
I wanted to follow one thread you raised (see below)...

On Wed, Apr 16, 2008 at 3:15 PM, Alan Knight <[hidden email]> wrote:
When you're loading code that contains a subsystem, that subsystem will activate after loading. Which, if you've got a subsystem that does those sorts of things, is probably inappropriate.


You say here that the subsystem will "activate after loading".  How soon after loading?  Immediately?

What I was seeing with Cairo here is that the CairoSystem wasn't being activated until after the -filein was completely finished.  Even when I split the load off into a -pcl followed by the -filein to do the rest of the work, CairoSystem wasn't being activated until after the -filein.

It seems to me that the activation of newly-loaded Subsystems isn't actually happening until the currently activating Subsystem (ImageConfigurationSystem in this case) is finished.  I can't tell if this is correct behavior or not.

They will activate once activation is finished in general. That is, there are a bunch of subsystems there, they start activating. If, in the process of activating, they create/load new ones, those new ones will get activated as part of the regular activation. It will at least wait until the current one is finished. It may wait until the whole round of things has finished. They will respect ordering.

It won't activate immediately, basically because starting an activation while in the middle of a different activation can have interesting side effects. Travis' suggestion of just having things activate when loaded would be similar. For example, suppose you're activating ImageConfigurationSystem, which is what does -pcl and -filein. And you load something that expects to activate after ImageConfigurationSystem. If we activated it immediately, then it's going to want to activate prerequisites first, and then will end up recursively trying to activate ImageConfigurationSystem and/or activating things that think they come after ImageConfigurationSystem beforehand.

There are some surprisingly subtle issues you get into with some of this stuff.

The issue of being able to do something at the end of startup is an interesting one. It comes up even more when what you want to do is save the image. Right now, the state of the art on that is -doit (Delay ...). Or write a subsystem to do the thing you want, and make it depend on e.g. RuntimeSystem. But for save image, you probably still need a delay anyway.

The trickiest thing with that is that as soon as you define a way to do something really last, someone will immediately want a way to do something after that.


--
Alan Knight [|], Engineering Manager, Cincom Smalltalk

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc