[Mono-dev] Threading issues in page_load event (in ASP.NET on mono)

Rafael Teixeira monoman at gmail.com
Wed May 30 10:12:42 EDT 2007


AFAIR, ASP.NET already does that for you, you can just configure the
timeout period, don't reinvent the wheel, please.

:)



On 5/30/07, Arun <arunarun2000 at gmail.com> wrote:
> Hi guys
>
> I am trying to run an asp.net application on mono. Please see whether
> you can help me out with the following problem.
>
> I am using a seperate thread to query a remote database, in the page
> load event of an aspx page.
> I am using this since it might take a really long time, for the query
> to return to return some results.
>
> So in another thread, I am monitoring how long it is taking to finish.
> If it taking more that 180 seconds, then I am aborting the query
> thread and printing error message accordingly.
>
> But if i run this on mono, I am getting a plain blank white page.
> (script timeout !!??)
> Also in the log I am seeing the "Trigerring Pageload.." message
> multiple times even when I opened the page only once !!
>
> I have included the code, below.
>
>         private void Page_Load(object sender, System.EventArgs e)
>                 {
>                         log.Debug("Trigerring Pageload..");
>
>                         Server.ScriptTimeout=600;
>
>                         ts_start = new ThreadStart(start_process);
>                         thread_starter = new Thread(ts_start);
>
>                         if(thread_starter.IsAlive != true)
>                         {
>                                 thread_starter.Start();
>                         }
>                         else
>                         {
>                                 show_webserver_error();
>                                 return;
>                         }
>
>                         int i = 0;
>
>                         while(thread_starter.ThreadState !=
> ThreadState.Stopped)
>                         {
>                                 System.Threading.Thread.Sleep(20000);
>
>                                 i++;
>                                 if(i > 8)
>                                 {
>                                         finish_process();
>                                         log.Debug("Query Aborted");
>                                         thread_starter.Abort();
>                                         return;
>                                 }
>                         }
>
>                 }
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>


-- 
Rafael "Monoman" Teixeira
---------------------------------------
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man." George Bernard Shaw



More information about the Mono-devel-list mailing list