dingir
asked on
Error: System.Threading.ThreadAbortException: Thread was being aborted.
This is the error I recieve when using my newly (and newbied) multi threading environment.
What I want is that this never should occur.
The situation above is that a user run a function from a webpage. That function does some things that can take 5-120 (or more) minutes to complete. If another user doing the same process (but with his/hers set of records from database) the already existing process get killed and spit this error on catch exception.
How do I make every click on that function/button to start on a unique/new/free thread/threadpool?! If the CPU is busy, the new thread should just sit and wait..
Thanks in advanced,
What I want is that this never should occur.
The situation above is that a user run a function from a webpage. That function does some things that can take 5-120 (or more) minutes to complete. If another user doing the same process (but with his/hers set of records from database) the already existing process get killed and spit this error on catch exception.
How do I make every click on that function/button to start on a unique/new/free thread/threadpool?! If the CPU is busy, the new thread should just sit and wait..
Thanks in advanced,
can u post the code u using to handle the threading?
ASKER
protected void Page_Load(object sender, EventArgs e)
{
System.Threading.Thread ts = System.Threading.Thread.Cu rrentThrea d;
}
protected void bnSend_Click(object sender, EventArgs e)
{
System.Threading.ThreadPoo l.QueueUse rWorkItem( new System.Threading.WaitCallb ack(StartS endThread) );
}
protected void StartSendThread(object state)
{
DataContext db = new DataContext();
Server.ScriptTimeout = 99932323;
Session.Timeout = 525600;
foreach (UserMessage usermsg in res)
{
try
{
usermsg.Send();
}
catch (System.Threading.ThreadAb ortExcepti on tae)
{
}
}
}
{
System.Threading.Thread ts = System.Threading.Thread.Cu
}
protected void bnSend_Click(object sender, EventArgs e)
{
System.Threading.ThreadPoo
}
protected void StartSendThread(object state)
{
DataContext db = new DataContext();
Server.ScriptTimeout = 99932323;
Session.Timeout = 525600;
foreach (UserMessage usermsg in res)
{
try
{
usermsg.Send();
}
catch (System.Threading.ThreadAb
{
}
}
}
>>foreach (UserMessage usermsg in res)
what is res?
what is res?
ASKER
the res contains the result of a linq'ed DataContext db = new DataContext();
like
var res = from u in db.Users
select u;
like
var res = from u in db.Users
select u;
ASKER
Some more ideas..? :-)
ASKER
Why can't I just choose to create a new thread or reuse same? Like every thread got a unique identifier that I want to attach, kill, check state of or being sure that next thread has another id..
>>process get killed and spit this error on catch exception.
what kind of exception is been thrown?
what kind of exception is been thrown?
ASKER
That error is the topic of this thread,
Error: System.Threading.ThreadAbo rtExceptio n: Thread was being aborted.
Error: System.Threading.ThreadAbo
does res is shared with all threads?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did the trix followed some guides that avoid the iis worker process from recycling and restarting..
also I did a exe file to do a schematic work.. that avoids all possible errors based on time running,
also I did a exe file to do a schematic work.. that avoids all possible errors based on time running,