Deployed application process not terminating

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

Deployed application process not terminating

Jurko Gospodnetic
Hi.

  I was wondering if there is a 'standard' way for solving the problem with
the main deployed application process not terminating that was introduced
in Dolphin Smalltalk 5.1. patch level 1?

  At the moment my application, when built from Dolphin Smalltalk image
version 5.1.1 or above (tried with 5.1.3 as well), leaves it's process
hanging
after it's last GUI is closed. It usually seems to hang for about 30
seconds,
but every so often it doesn't terminate at all.

  I also noticed that this problem has already been somewhat discussed on
these newsgroups (See thread: 'D5.1 exe shutdown problem; patch URLs'
started on 30th July, 2003. by Bill Schwab) but haven't been able to find
any conclusive answer to it. Not even an acknowledgement that this is in
fact a bug with the Dolphin image.

  This behavior is presenting me with problems because the application I'm
working on is a 'single-instance' application that refuses to start if there
is
already a previous instance running in the system and that hanging process
is detected as that 'previous instance'.

  When deploying the application from earlier images (tried 5.1.0 and
5.0.3.)
the main application process terminates as expected.

  Any ideas or comments?

  Many  thanks.
    Jurko


Reply | Threaded
Open this post in threaded view
|

Re: Deployed application process not terminating

Andy Bower-3
Jurko,

>   I was wondering if there is a 'standard' way for solving the
> problem with the main deployed application process not terminating
> that was introduced in Dolphin Smalltalk 5.1. patch level 1?
>
>   At the moment my application, when built from Dolphin Smalltalk
> image version 5.1.1 or above (tried with 5.1.3 as well), leaves it's
> process hanging
> after it's last GUI is closed. It usually seems to hang for about 30
> seconds,
> but every so often it doesn't terminate at all.
>
>   I also noticed that this problem has already been somewhat
> discussed on these newsgroups (See thread: 'D5.1 exe shutdown
> problem; patch URLs' started on 30th July, 2003. by Bill Schwab) but
> haven't been able to find any conclusive answer to it. Not even an
> acknowledgement that this is in fact a bug with the Dolphin image.

The problem has been caused by some bug fixes (#969 and #1272) which
have made the original "lazy" shutdown scheme unreliable. The "lazy"
scheme works by attempting to determine if there are any visible open
windows and shutting down the app if there is none. It probably can be
classified as a bug but only really because the existing samples were
originally coded to rely on the lazy mechanism and therefore now
exhibit the same problem.

Really, though, applications should not rely the lazy shutdown and
should instead be coded to perform an explicit exit as the Dolphin
development system itself does. The correct shutdown mechanism is to
include:

MyAppShell>>onViewClosed
        super onViewOpened.
        SessionManager current isRuntime ifTrue: [
                SessionManager current exit]

Note that the #isRuntime test is required to prevent the closure of the
application shell window shutting down all of Dolphin when operating in
a development image.

--
Andy Bower
Dolphin Support
www.object-arts.com


Reply | Threaded
Open this post in threaded view
|

Re: Deployed application process not terminating

Jurko Gospodnetic
Hi Andy.

> Really, though, applications should not rely the lazy shutdown and
> should instead be coded to perform an explicit exit as the Dolphin
> development system itself does. The correct shutdown mechanism is to
> include:

  Ok, thanks for the explanation. That infact is exactly what I already
did to quickly patch this up in my application, but didn't expect that to
be the 'official solution'.

> MyAppShell>>onViewClosed
> super onViewOpened.
> SessionManager current isRuntime ifTrue: [
> SessionManager current exit]

  Heh, hopefully that's not a copy-paste from real code - I guess you
ment 'super onViewClosed' :-)

  Thanks again!

  Best regards,
    Jurko


Reply | Threaded
Open this post in threaded view
|

Re: Deployed application process not terminating

Andy Bower-3
Jurko,

> > MyAppShell>>onViewClosed
> > super onViewOpened.
> > SessionManager current isRuntime ifTrue: [
> > SessionManager current exit]
>
>   Heh, hopefully that's not a copy-paste from real code - I guess you
> ment 'super onViewClosed' :-)
>

Oops yes I did mean #onViewClosed. Just keep it all in one place here
is the corrected version:

MyAppShell>>onViewClosed
        super onViewClosed.
        SessionManager current isRuntime ifTrue: [
                SessionManager current exit]

BTW, actually it *was* a copy/paste from real code so.. thanks for the
bug fix!!

--
Andy Bower
Dolphin Support
www.object-arts.com


Reply | Threaded
Open this post in threaded view
|

Re: Deployed application process not terminating

Bill Schwab-2
In reply to this post by Andy Bower-3
Andy,

> Really, though, applications should not rely the lazy shutdown and
> should instead be coded to perform an explicit exit as the Dolphin
> development system itself does. The correct shutdown mechanism is to
> include:
>
> MyAppShell>>onViewClosed
> super onViewOpened.
> SessionManager current isRuntime ifTrue: [
> SessionManager current exit]
>
> Note that the #isRuntime test is required to prevent the closure of the
> application shell window shutting down all of Dolphin when operating in
> a development image.

I respectfully disagree, because this revised design assumes that the app
has a single shell.  FWIW, all of my deployed apps have singleton shells,
and I was able to cobble together a solution in the form of
SessionManager>>mainShell:.  However, #keepAlive served well for a long
time, and IMHO, was an elegant solution to the problem.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Deployed application process not terminating

Andy Bower-3
Bill,

> > Really, though, applications should not rely the lazy shutdown and
> > should instead be coded to perform an explicit exit as the Dolphin
> > development system itself does. The correct shutdown mechanism is to
> > include:
> >
> > MyAppShell>>onViewClosed
> > super onViewOpened.
> > SessionManager current isRuntime ifTrue: [
> > SessionManager current exit]
> >
> > Note that the #isRuntime test is required to prevent the closure of
> > the application shell window shutting down all of Dolphin when
> > operating in a development image.
>
> I respectfully disagree, because this revised design assumes that the
> app has a single shell.  FWIW, all of my deployed apps have singleton
> shells, and I was able to cobble together a solution in the form of
> SessionManager>>mainShell:.  

Ok, perhaps what I should have said was that the correct way is for the
application to manage it's own shutdown. In the case of applications
with a main shell this can be implemented as above.

> However, #keepAlive served well for a
> long time, and IMHO, was an elegant solution to the problem.

Well the solution was only elegant while it worked :-) And, even if we
can get it working again it still wasn't appropriate in all situations
(e.g. applications or servers that have no windows at all).

--
Andy Bower
Dolphin Support
www.object-arts.com