Hello,
I have an application, that has been running on a single processor server
for more then a year without any problems. Now I'm migrating to a dual
processor server, and I'm experiencing problems with threading.
The application is actually a kind of job schedular. For all jobs, I can set
a recurring interval (daily,weekly, monthly etc) at which the specific job
should be started. We program each job, according to an interface. Examples
of jobs are: server monitoring, reporting, messaging etc.
The job itself maintains a status. When it's complete, it's status is set to
ready.
The job-schedular looks at certain times for two things: Should I start a
new job and Is there a job with status Ready which should be stopped.
the code for stopping a job is only a:
ji.InstanceThread.Abort();
ji.InstanceThread.Join(1000);
MJSJobList._jobList.Remove(ji);
What I now see, is that on the single processor server, this works, and the
job is removed from the list.
On the dual-processor server, however the job remains in the list with
status "Ready"..
Am I missing somethinge here ? The code worked perfectly on the other server
for a very long time.
Thanks in advance,
Michel Meex 3 1423
Michel,
Can you provide a more complete snipet of code? It's too difficult to
say what might be happening based only on 3 lines.
Brian
Michel Meex wrote: Hello,
I have an application, that has been running on a single processor server for more then a year without any problems. Now I'm migrating to a dual processor server, and I'm experiencing problems with threading.
The application is actually a kind of job schedular. For all jobs, I can set a recurring interval (daily,weekly, monthly etc) at which the specific job should be started. We program each job, according to an interface. Examples of jobs are: server monitoring, reporting, messaging etc.
The job itself maintains a status. When it's complete, it's status is set to ready.
The job-schedular looks at certain times for two things: Should I start a new job and Is there a job with status Ready which should be stopped.
the code for stopping a job is only a: ji.InstanceThread.Abort(); ji.InstanceThread.Join(1000); MJSJobList._jobList.Remove(ji);
What I now see, is that on the single processor server, this works, and the job is removed from the list. On the dual-processor server, however the job remains in the list with status "Ready"..
Am I missing somethinge here ? The code worked perfectly on the other server for a very long time.
Thanks in advance, Michel Meex
Agreed. Not much to go on.
As a wild stab in the dark I would point out that any resource that is
accessed from more than one thread should really be marked as volatile. This
effectively says, don't get this from processor cached memory, do a read
from system memory. It is especially important to consider this in mult-proc
enviroments as your threads may end up executing on different chips.
In this case apply volatile to _jobList in MJSJobList.
"Brian Gideon" <br*********@yahoo.com> wrote in message
news:11**********************@f6g2000cwb.googlegro ups.com... Michel,
Can you provide a more complete snipet of code? It's too difficult to say what might be happening based only on 3 lines.
Brian
Michel Meex wrote: Hello,
I have an application, that has been running on a single processor server for more then a year without any problems. Now I'm migrating to a dual processor server, and I'm experiencing problems with threading.
The application is actually a kind of job schedular. For all jobs, I can set a recurring interval (daily,weekly, monthly etc) at which the specific job should be started. We program each job, according to an interface. Examples of jobs are: server monitoring, reporting, messaging etc.
The job itself maintains a status. When it's complete, it's status is set to ready.
The job-schedular looks at certain times for two things: Should I start a new job and Is there a job with status Ready which should be stopped.
the code for stopping a job is only a: ji.InstanceThread.Abort(); ji.InstanceThread.Join(1000); MJSJobList._jobList.Remove(ji);
What I now see, is that on the single processor server, this works, and the job is removed from the list. On the dual-processor server, however the job remains in the list with status "Ready"..
Am I missing somethinge here ? The code worked perfectly on the other server for a very long time.
Thanks in advance, Michel Meex
Ok, here's some more code.
In the windows service, a timer executes the following method:
internal void MonitorJobs()
{
ArrayList al = this.RetrieveJobsState();
foreach(MJSJobState js in al)
{
//If job is ready
if (js.JobState == MJSJobStatic.JobState.Ready)
{
TempLogging(js.JobName,"Job found, status ready, should stop");
bool _found = false;
//stop and clear job
foreach (MJSJobInstance ji in MJSJobList._jobList)
{
if (ji.JobData.JobName == js.JobName)
{
_found = true;
this.JobStop(ji.JobData);
break; }
}
TempLogging(js.JobName,"Job found: " + _found.ToString());
}
}
}
the method JobStop contains the following:
public void JobStop(MJSJobData jobData)
{
if (jobData != null)
{
//if job is running
if (this.JobIsRunning(jobData) ==
MJSJobStatic.ThreeValueBool.True)
{
bool jobStopped = false;
//Find job instance in joblist
foreach (MJSJobInstance ji in MJSJobList._jobList)
{
if (jobData != null)
{
if (jobData.JobName == ji.JobData.JobName)
{
//Call job stop method (IJob interface),
((IJob) ji.InstanceObject).Stop();
//Clear object reference
ji.InstanceObject = null;
//Stop process / end thread
ji.InstanceThread.Abort();
ji.InstanceThread.Join(1000);
//debugging info
HistoryData _tempHistoryNew = new HistoryData();
_tempHistoryNew.JobName = ji.JobData.JobName;
_tempHistoryNew.Type = MJSJobStatic.HistoryType.Information;
_tempHistoryNew.Time = System.DateTime.Now;
_tempHistoryNew.Extra = "trying to stop.....debug info";
JobHistory.Add(_tempHistoryNew);
//end debugging info
//Remove job from JobList
MJSJobList._jobList.Remove(ji);
jobStopped = true;
break;
}
}
}
if (jobStopped)
{
//Log event
HistoryData _tempHistoryNew = new HistoryData();
_tempHistoryNew.JobName = jobData.JobName;
_tempHistoryNew.Type = MJSJobStatic.HistoryType.Information;
_tempHistoryNew.Time = System.DateTime.Now;
_tempHistoryNew.Extra = JOB_STOPPED;
JobHistory.Add(_tempHistoryNew);
}
else
{
//Log event
HistoryData _tempHistoryNew = new HistoryData();
_tempHistoryNew.JobName = jobData.JobName;
_tempHistoryNew.Type = MJSJobStatic.HistoryType.Error;
_tempHistoryNew.Time = System.DateTime.Now;
_tempHistoryNew.Extra = "Job could not be stopped.";
JobHistory.Add(_tempHistoryNew);
}
}
else
{
//Write something to the log
//Log event
HistoryData _tempHistoryNew = new HistoryData();
_tempHistoryNew.JobName = jobData.JobName;
_tempHistoryNew.Type = MJSJobStatic.HistoryType.Error;
_tempHistoryNew.Time = System.DateTime.Now;
_tempHistoryNew.Extra = "Job could not be stopped. The job is not
running.";
JobHistory.Add(_tempHistoryNew);
}
}
else
{
//Write something to the log if running state of job could not be
determined
//Log event
HistoryData _tempHistoryNew = new HistoryData();
_tempHistoryNew.JobName = string.Empty;
_tempHistoryNew.Type = MJSJobStatic.HistoryType.Error;
_tempHistoryNew.Time = System.DateTime.Now;
_tempHistoryNew.Extra = "Job could not be stopped. No job provided.";
JobHistory.Add(_tempHistoryNew);
}
}
I hope you can do something with this..
Regards,
Michel This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tomer Ben-David |
last post by:
Hi
I have a big j2ee appliction that was so forth run on a single cpu
machine.
I have tested it on a dual cpu machine, its running much slower (about
X3 times slower).
I know that...
|
by: Frank |
last post by:
Hi,
we are using oracle clients (Release 9.0.1.0.1 - Production)
on an NT4 (Service Pack6) computers. the server is a W2K,
(Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
With the...
|
by: seesharp |
last post by:
Hi,
we have a multithreaded application (win service) written
in C# that is running well on all but one box. The only
difference we see between the problem box and the good
ones is that the...
|
by: Amit Dedhia |
last post by:
Hi
I am developing a Dot net application (involving image processing) on
a uni processor. It works well on my machine. I then take all my code
on a multi processor, build and run the application...
|
by: cwahlmeier |
last post by:
Greetings,
I am running DB2 Workgroup Edition on an Intel box with two physical
CPUs. It is running Windows with hyperthreading. Thus, the operating
system thinks it has 4 cpus. I am about to...
| |
by: Darryl Kerkeslager |
last post by:
Not that I'm going to go out and buy a new motherboard, but, will a dual
processor PC run a huge report query and still allow a user to use other
programs while the query is running?
--...
|
by: Michel Meex |
last post by:
Hello,
I have an application, that has been running on a single processor server
for more then a year without any problems. Now I'm migrating to a dual
processor server, and I'm experiencing...
|
by: xtseeker |
last post by:
We have a multi-threaded .NET application, the problem is that the
previous programmer didn't care to have locks on the shared variables.
Somehow the application doesn't end up in Locked state on a...
|
by: teddysnips |
last post by:
I am preparing a proposal for a new client. The client has bought a
dual-processor server, but is keen to save money. They run a very
small business, and I believe that the 4 Gb limit on SQL...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |