Re: Thread Shutdown

Hi Doug, thanks for the pointer.  It's no coincidence that that archived
article was from a woman who used to be on the project I am now on ;)

Hmm, I'm still a little worried. Saying "try sleeping a second or two"
seems a little vague, as though there is a race condition lurking.  I
shall put a sleep in nevertheless , and maybe poke around the source code
to hunt down any nasty condition.  As a helpfull start, which classes
generate new threads??

Many thanks

Stuart


On Wed, 17 Nov 2004, Doug Lindholm wrote:

> Hi,
>
> There is something in the mail archive related to this.
> (http://my.unidata.ucar.edu/cgi-bin/getfile?file=/content/support/help/MailArchives/visad-list/msg04606.html)
>
> It seems that putting a delay between the destroys and the
> stopThreadPool() might help.
>
> Doug
>
> Bill Hibbard wrote:
> > Hi Stuart,
> >
> >
> >>Hi, I am new to visad but am enjoying using it, except for a lack of
> >>understanding in the thread model.
> >>
> >>I am doing some offscreen image creation using DisplayImpl.getImage(true),
> >>have added data for a number of FlatFields.  The images come out great.
> >>I should point out that I am using the same DisplayImpls over and over for
> >>all images.  I'm using just 2D rendering.
> >>
> >>However, when I want to shutdown the visad part of my app, sometimes it
> >>hangs.  I'm doing this:
> >>
> >>displayImplA.destroy();
> >>displayImplB.destroy();
> >>ActionImpl.stopThreadPool();
> >>
> >>sometimes these three lines return OK.  Sometimes I get an exception
> >>mentioning a task queue (??) and sometimes it just hangs.  This is bad,
> >>since I run this job as a cron and the app must exit after it has done.
> >>
> >>Any help very gratefully appreciated.  I apologise of this is  FAQ, I
> >>couldn't locate it.  On  a broader note, how many threads should I expect
> >>if using two DisplayImpls.
> >
> >
> > Its not a FAQ - we've never seen this problem before.
> >
> > We do need more information. Specifically, a stack dump with
> > line numbers for the Exception. And if you can get it to hang
> > while running under jdb, the output of 'where all' once it
> > hangs (as I recall, you need to run 'suspend all' before you
> > run 'where all').
> >
> > Cheers,
> > Bill
>
> --
> *----------------------------------------------------------------------*
> | Doug Lindholm, Software Engineer          |  E-mail: lind@xxxxxxxx   |
> | Unidata Program Center                    |   Phone: 303-497-8659    |
> | UCAR Office of Programs                   |                          |
> | P.O. Box 3000                             |     There's no place     |
> | Boulder, Colorado 80307-3000              |        like $HOME        |
> *----------------------------------------------------------------------*
>