change i need to do. hopefully somebody here can give me a tipp which
will be usefull to solve my problem.
I'm using a thread-pool within my WebSite which done some requests to
several interfaces the readed data will be added to the cache. This
operations consumes much CPU and I want to have this outside my
website so i decided to change the flow.
It should looks now like this:
User Request -Internal Call to DB to read needed Interfaces to
Invoke -Create Base Shared Cache Object and Add it to Shared Cache -
Call the WebService -Navigate to Result pageThr result page will trigger the Website and the Code Behind triggers
the shared Cache to check if results already available.
All I have done so far is a new WebService Project which contains the
same references to the same Sub-Projects. With this i'm able to split
up the Invokes to the interfaces on a different machine if needed.
Now i'm able to execute exaclty the same code like it would be in the
WebSite. The only problem is that after several seconds ( normally
between 5 - 10 sec.) my Threads in the Pool are getting aborted :-
( from some unclear reason.
A first chance exception of type
'System.Threading.ThreadAbortException' occurred in mscorlib.dll <-
for each of my threads
in addition i see also this message:
The thread 0xa060 has exited with code 0 (0x0).
in the beginning i thought it will has to do something with a timeout
but even if I add the following lines to my web.config file:
<system.web>
<httpRuntime executionTimeout="30000"/>
</system.web>
it does not help.
The pool itself is initilized within a background thread from in the
Application_Start like this:
1 System.Threading.Thread acceptThread;
2 acceptThread = new
System.Threading.Thread(Pool.ThreadPoolManagement. ThreadPoolInit);
3 acceptThread.IsBackground = true;
4 acceptThread.Priority = System.Threading.ThreadPriority.Normal;
5 acceptThread.Name = "ThreadPoolBasic";
6 acceptThread.Start();
so its even have a specific thread for itself. the pool is static
defined:
1 private static COM.Pool.ThreadPool pool;
2
3 public static void ThreadPoolInit()
4 {
5 if(pool == null)
6 {
7 int min = 25;
8 int max = 32;
9 pool = new COM.Pool.ThreadPool(min,max,"Pool1");
10 pool.DynamicThreadDecay = 1000;
11 pool.Priority = System.Threading.ThreadPriority.AboveNormal;
12 pool.NewThreadTrigger = 100;
13 }
14 if (!pool.IsStarted)
15 {
16 LogHandler.Info("Call Pool1 pool.Start();");
17 pool.Start();
18 }
19 }
20
The exception i receive in my log file look like this:
Exception thrown performing callback:
Thread was being aborted.
at System.RuntimeMethodHandle._InvokeMethodFast(Objec t target,
Object[] arguments, SignatureStruct& sig, MethodAttributes
methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target,
Object[] arguments, Signature sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at
MergeSystem.Indexus.Common.Pool.ThreadPool.ThreadW rapper.ThreadProc()
in D:\Dev\......FilePath.......\ThreadPool.cs:line 926
thank you very much in advance for any help.
kind regards,
roni