[vwnc] Stopping headless image on Linux

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

[vwnc] Stopping headless image on Linux

Ernst-2
Hi,
How does one stop a headless image on Linux?

/bin/kill  -TERM  <pid>
The headful VisualWorks image exits AFTER it has invoked
#tearDown in my subclass of UserApplication.
That is great because in #tearDown I save the object graph using BOSS.

Then I save as headless:
 /bin/kill  -TERM  <pid>  the image does not exit
 /bin/kill  -KILL  <pid>   it exits but #tearDown is not invoked
The headless-transcript.log does not tell what happened.
Do I need to set up some kind of inter-process communication to stop it
gracefully?

man kill
[...]
KILL       9  exit  this signal may not be blocked
TERM  15  exit
 
Thank you
Ernst
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Stopping headless image on Linux

david.long
ps -ef | grep visual

then

kill -9 <pid>

regards,

David

On Sat, 2008-11-08 at 17:14 +1100, Ernst wrote:
Hi,
How does one stop a headless image on Linux?

/bin/kill  -TERM  <pid> 
The headful VisualWorks image exits AFTER it has invoked
#tearDown in my subclass of UserApplication.
That is great because in #tearDown I save the object graph using BOSS.

Then I save as headless:
 /bin/kill  -TERM  <pid>  the image does not exit
 /bin/kill  -KILL  <pid>   it exits but #tearDown is not invoked
The headless-transcript.log does not tell what happened.
Do I need to set up some kind of inter-process communication to stop it 
gracefully?

man kill
[...]
KILL       9  exit  this signal may not be blocked
TERM  15  exit
  
Thank you
Ernst
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Your business, your way.
http://sageteagroup.com

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

Re: [vwnc] Stopping headless image on Linux

Ernst-2
For the headless image
kill  <pid>
does not result in the image invoking #tearDown
and therefore the objects are not saved!
Strangely it works for the headful image.

kill -9 <pid> (same as: kill -KILL <pid>) gives the image not a chance to save
in either case.

Regards,
Ernst

On Saturday 08 November 2008 19:35, david wrote:

> ps -ef | grep visual
>
> then
>
> kill -9 <pid>
>
> regards,
>
> David
>
> On Sat, 2008-11-08 at 17:14 +1100, Ernst wrote:
> > Hi,
> > How does one stop a headless image on Linux?
> >
> > /bin/kill  -TERM  <pid>
> > The headful VisualWorks image exits AFTER it has invoked
> > #tearDown in my subclass of UserApplication.
> > That is great because in #tearDown I save the object graph using BOSS.
> >
> > Then I save as headless:
> >  /bin/kill  -TERM  <pid>  the image does not exit
> >  /bin/kill  -KILL  <pid>   it exits but #tearDown is not invoked
> > The headless-transcript.log does not tell what happened.
> > Do I need to set up some kind of inter-process communication to stop it
> > gracefully?
> >
> > man kill
> > [...]
> > KILL       9  exit  this signal may not be blocked
> > TERM  15  exit
> >
> > Thank you
> > Ernst
> > _______________________________________________
> > vwnc mailing list
> > [hidden email]
> > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
> Your business, your way.
> http://sageteagroup.com
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Stopping headless image on Linux

Steven Kelly
In reply to this post by Ernst-2
Take a look at the ServiceStartup package in the public repository. That
recognizes SIGUSR2, SIGTERM or SIGHUP, and can execute a block when
receiving them. See Startup>>initializeUnixSignals. Although most of the
package is connected with making a headless image start up as a Windows
service (with the WinService package), the Unix signal code is only a
few lines and hence easy to copy. Thanks to the COAST guys for their
work!

Steve

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On
> Behalf Of Ernst
> Sent: 08 November 2008 08:14
> To: [hidden email]
> Subject: [vwnc] Stopping headless image on Linux
>
> Hi,
> How does one stop a headless image on Linux?
>
> /bin/kill  -TERM  <pid>
> The headful VisualWorks image exits AFTER it has invoked
> #tearDown in my subclass of UserApplication.
> That is great because in #tearDown I save the object graph using BOSS.
>
> Then I save as headless:
>  /bin/kill  -TERM  <pid>  the image does not exit
>  /bin/kill  -KILL  <pid>   it exits but #tearDown is not invoked
> The headless-transcript.log does not tell what happened.
> Do I need to set up some kind of inter-process communication to stop
it

> gracefully?
>
> man kill
> [...]
> KILL       9  exit  this signal may not be blocked
> TERM  15  exit
>
> Thank you
> Ernst
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

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

Re: [vwnc] Stopping headless image on Linux

Alan Knight-2
In reply to this post by Ernst-2
That seems very peculiar. Unless the image is really blasted away I would expect subsystem actions to fire, and I wouldn't expect any difference between headless and headful other than which systems were active. Did the setUp on your system run? If you run the headless image with -gui, does it run? And vice versa, if you don't save headless, but merely invoke with -nogui?

At 01:14 AM 11/8/2008, Ernst wrote:
Hi,
How does one stop a headless image on Linux?

/bin/kill  -TERM  <pid>
The headful VisualWorks image exits AFTER it has invoked
#tearDown in my subclass of UserApplication.
That is great because in #tearDown I save the object graph using BOSS.

Then I save as headless:
 /bin/kill  -TERM  <pid>  the image does not exit
 /bin/kill  -KILL  <pid>   it exits but #tearDown is not invoked
The headless-transcript.log does not tell what happened.
Do I need to set up some kind of inter-process communication to stop it
gracefully?

man kill
[...]
KILL       9  exit  this signal may not be blocked
TERM  15  exit
 
Thank you
Ernst
_______________________________________________
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] Stopping headless image on Linux

Stefan Schmiedl
On Sat, 08 Nov 2008 13:16:33 -0500
Alan Knight <[hidden email]> wrote:

> If you run the headless
> image with -gui, does it run? And vice versa, if you don't save
> headless, but merely invoke with -nogui?

While we're at it: What's the difference between a headful image
running with -nogui, with -headless and a beheaded image started
without these options?

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

Re: [vwnc] Stopping headless image on Linux

Alan Knight-2
At 02:45 PM 11/8/2008, Stefan Schmiedl wrote:
On Sat, 08 Nov 2008 13:16:33 -0500
Alan Knight <[hidden email]> wrote:

> If you run the headless
> image with -gui, does it run? And vice versa, if you don't save
> headless, but merely invoke with -nogui?

While we're at it: What's the difference between a headful image
running with -nogui, with -headless and a beheaded image started
without these options?

-nogui and -headless are exactly the same, which you can tell if you look at the implementation of #nogui.

Both of them will set the "canActivate" flag on WindowingSystem. So when it comes time to start up the WindowingSystem or anything that depends on it, it won't. In additiona, the BasicGraphicsSystem checks this flag and decides which of its subclasses will activate. Between these two things, the image starts up without a GUI.

Saving an image headless just sets this option to default to false. The command line options, whether -gui/-nogui or -headless/-headful just set that flag early during image startup. There should be essentially no difference in image behaviour between the two.

--
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] Stopping headless image on Linux

Stefan Schmiedl
In reply to this post by Stefan Schmiedl
Thank you for the explanation, Alan.

On Sat, 08 Nov 2008 15:57:33 -0500
Alan Knight <[hidden email]> wrote:

> Saving an image headless just sets this option to default to false.
> The command line options, whether -gui/-nogui or -headless/-headful
> just set that flag early during image startup. There should be
> essentially no difference in image behaviour between the two.

Then this would mean that in the OP's case, both headful and headless
image do handle the signals, only in the headless case, the handler is
empty?

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

Re: [vwnc] Stopping headless image on Linux

Ernst-2
In reply to this post by Ernst-2
Yes #setUp is invoked each time.

Maybe I use the wrong VM? I change from vwlinux86gui to visual and then save
headless. Then try:
linux86/visual               work1headlessTMP.im       still same
linux86/visual -gui       work1headlessTMP.im       still same
linux86/visual -nogui  work1.im              Fatal error: No such option 'n'

This is VW7.6nc with seaside loaded from the public repository.

Thank you
Ernst

On Sunday 09 November 2008 05:16, Alan Knight wrote:

> That seems very peculiar. Unless the image is really blasted away I would
> expect subsystem actions to fire, and I wouldn't expect any difference
> between headless and headful other than which systems were active. Did the
> setUp on your system run? If you run the headless image with -gui, does it
> run? And vice versa, if you don't save headless, but merely invoke with
> -nogui?
>
> At 01:14 AM 11/8/2008, Ernst wrote:
> >Hi,
> >How does one stop a headless image on Linux?
> >
> >/bin/kill  -TERM  <pid>
> >The headful VisualWorks image exits AFTER it has invoked
> >#tearDown in my subclass of UserApplication.
> >That is great because in #tearDown I save the object graph using BOSS.
> >
> >Then I save as headless:
> > /bin/kill  -TERM  <pid>  the image does not exit
> > /bin/kill  -KILL  <pid>   it exits but #tearDown is not invoked
> >The headless-transcript.log does not tell what happened.
> >Do I need to set up some kind of inter-process communication to stop it
> >gracefully?
> >
> >man kill
> >[...]
> >KILL       9  exit  this signal may not be blocked
> >TERM  15  exit
> >
> >Thank you
> >Ernst
> >_______________________________________________
> >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
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Stopping headless image on Linux

Ernst-2
In reply to this post by Steven Kelly
First try:
        self
                onUnixSignals: #('SIGTERM')
                do:
                        [Transcript show: 'TERM signal received - write object graph to file'.
                        self triggerEvent: #aboutToQuit]
But this did not invoke #tearDown!

Second try works, it runs #tearDown :
        self
                onUnixSignals: #('SIGTERM')
                do:
                        [Transcript show: 'TERM signal received - write object graph to file'.
                        ObjectMemory quit]

Many thanks
Ernst

On Sunday 09 November 2008 02:56, Steven Kelly wrote:

> Take a look at the ServiceStartup package in the public repository. That
> recognizes SIGUSR2, SIGTERM or SIGHUP, and can execute a block when
> receiving them. See Startup>>initializeUnixSignals. Although most of the
> package is connected with making a headless image start up as a Windows
> service (with the WinService package), the Unix signal code is only a
> few lines and hence easy to copy. Thanks to the COAST guys for their
> work!
>
> Steve
>
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]] On
> > Behalf Of Ernst
> > Sent: 08 November 2008 08:14
> > To: [hidden email]
> > Subject: [vwnc] Stopping headless image on Linux
> >
> > Hi,
> > How does one stop a headless image on Linux?
> >
> > /bin/kill  -TERM  <pid>
> > The headful VisualWorks image exits AFTER it has invoked
> > #tearDown in my subclass of UserApplication.
> > That is great because in #tearDown I save the object graph using BOSS.
> >
> > Then I save as headless:
> >  /bin/kill  -TERM  <pid>  the image does not exit
> >  /bin/kill  -KILL  <pid>   it exits but #tearDown is not invoked
> > The headless-transcript.log does not tell what happened.
> > Do I need to set up some kind of inter-process communication to stop
>
> it
>
> > gracefully?
> >
> > man kill
> > [...]
> > KILL       9  exit  this signal may not be blocked
> > TERM  15  exit
> >
> > Thank you
> > Ernst
> > _______________________________________________
> > vwnc mailing list
> > [hidden email]
> > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Stopping headless image on Linux

Stefan Schmiedl
In reply to this post by Ernst-2
On Sun, 9 Nov 2008 17:14:27 +1100
Ernst <[hidden email]> wrote:

> Yes #setUp is invoked each time.
>
> Maybe I use the wrong VM? I change from vwlinux86gui to visual and
> then save headless. Then try:
> linux86/visual               work1headlessTMP.im       still same
> linux86/visual -gui       work1headlessTMP.im       still same
> linux86/visual -nogui  work1.im              Fatal error: No such option 'n'

FWIW, I run my headless images with
        visual image.im -headless

i.e. -headless is an option to the image, not the VM.

        visual -?
shows the VM options

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

Re: [vwnc] Stopping headless image on Linux

Ernst-2
Wasn't aware of image options.
usage: visual [engine options] -=imagefile.im [image options]

BasicGraphicsSystem>>headful   or  headless

So I try once more the options suggested by Alan:
visual  -=work1headful.im -headless //kill <pid> does not run #tearDown
visual  -=work1headlessTMP.im  -headful  //kill <pid> runs #tearDown

Thanks
Ernst

On Sunday 09 November 2008 19:57, Stefan Schmiedl wrote:

> On Sun, 9 Nov 2008 17:14:27 +1100
>
> Ernst <[hidden email]> wrote:
> > Yes #setUp is invoked each time.
> >
> > Maybe I use the wrong VM? I change from vwlinux86gui to visual and
> > then save headless. Then try:
> > linux86/visual               work1headlessTMP.im       still same
> > linux86/visual -gui       work1headlessTMP.im       still same
> > linux86/visual -nogui  work1.im              Fatal error: No such option
> > 'n'
>
> FWIW, I run my headless images with
> visual image.im -headless
>
> i.e. -headless is an option to the image, not the VM.
>
> visual -?
> shows the VM options
>
> s.
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc