The idea here is to loop through all threads and find those which are
deemed to be no good.  What is the proper way to identify them based on
thread properties?

thread_state = 1
time_started = NULL
time_finished = NULL

Is it safe to assume that when the above three conditions exist for a
thread, it will never be executed?  What is strange about this entire
problem is that executors that have been assigned these threads no
longer accept new threads for execution.  The Manager is aware of the
executor (at least it appears to be based on the DB tables / Admin
Console), but the executor thinks it is working on something.

If the above is a valid heuristic, looping through the threads from the
collection, App.Manager.Admon_GetThreadList will not provide me with the
ability to cancel an Executor's execution of a thread, nor does it let
me restart it.  How can one cancel/reassign/restart a thread without
nesting several loops?


-----Original Message-----
Subject: RE: [Alchemi-developers] How and when are ThreadStates set?

Hi Luis,

The app.Threads collection is representing the threads as they look like
to
the user when the threads are created. In order to see the data stored
in
the database you should use the ThreadStorageView structure accessible
through the Manager object.

Here's a sample:

ThreadStorageView[] threads =
App.Manager.Admon_GetThreadList(App.Credentials, App.Id);

foreach (ThreadStorageView thread in threads)
{
    Console.WriteLine("{0} = {1} - {2}, {3}, {4}", 
                thread.ThreadId, 
                thread.TimeStartedSet ? thread.TimeStarted.ToString() :
"Not
started",
                thread.TimeFinishedSet ? thread.TimeFinished.ToString()
:
"Not finished",
                thread.State,
                thread.ExecutorId
                );
}

While playing with this I noticed that the Time Started and Finished are
not
populated properly even if the data is in the database. I put in a bug
report with this, it should be fixed soon.

Regards,
Tibor

> -----Original Message-----
> From: Luis Cota [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 07, 2006 2:22 PM
> To: Tibor Biro; [email protected]; alchemi-
> [EMAIL PROTECTED]
> Subject: RE: [Alchemi-developers] How and when are ThreadStates set?
> 
> Is there any indication of what types of threads cause the Manager to
> lose track of a thread?  Could this be machine dependant?  All the
> machines I have available have similar configurations (some with Quad
> processors), but all machine configurations have had an executor and
all
> have had this problem at some point.
> 
> I've also tried the Manager app on different machines which did not
> alleviate the problem.  What kind of heuristic can I use (reliably) to
> determine which threads should be killed and restarted?  When I
attempt
> to cycle through the threads of a GApplication object that has been
> started, a runtime exception is thrown.  Is there another way that I
can
> check for this error?  In addition, supposing I could cycle through
> these threads, I don't see a clear way of accessing the Time_Started /
> Time_Finished properties of a GThread through the API.
> 
> 
> The code I have to cycle through app.Threads is below. Variable wtf is
> set to false because of the runtime error mentioned above.
> 
> bool wtf = false;
> while(AppRunning)
> {
>       Thread.Sleep(500);
>       if(wtf)
>       {
>               foreach (GThread g in app.Threads)
>               {
>                       if (g.State ==
> Alchemi.Core.Owner.ThreadState.Scheduled)
>                       {
>                               g.Start();
>                       }
>               }
>       }
> }
> 
> 
> - Luis
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Tibor Biro
> Sent: Monday, February 06, 2006 1:13 PM
> To: Luis Cota; [email protected]
> Subject: RE: [Alchemi-developers] How and when are ThreadStates set?
> 
> > Often, when I use Alchemi across a small grid, I find that I get
> undead
> > threads.  When I examine the undead threads in the database, they
all
> > have the following properties:
> >
> > thread_state = 1
> > time_started = NULL
> > time_finished = NULL
> >
> > The threads have been assigned but it is not clear whether the
threads
> > have been started.  In the same DB with the same grid, I regularly
see
> a
> > completed thread with time_started = NULL, so this is not a reliable
> > indicator of whether a thread has been started.
> >
> > What could cause these two properties to not be set correctly?  Is
> there
> > some way to check the time_started/time_finished properties through
> the
> > API?
> 
> This could happen if the Manager lost track of the thread after it was
> scheduled due to some error. Currently there is no recovery built into
> the
> manager for such scenarios.
> 
> The API would give you the same data that is in the database. There is
> something that can be used to see this data, it is used by the
Console.
> 
> Tibor
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD
SPLUNK!
>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> Alchemi-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/alchemi-developers




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Alchemi-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alchemi-developers




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
alchemi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alchemi-users

Reply via email to