[Mono-bugs] [Bug 342640] New: [Regression] System.Threading.Timer leaks thread handles. ..

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Nov 19 03:37:25 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=342640

           Summary: [Regression] System.Threading.Timer leaks thread
                    handles...
           Product: Mono: Class Libraries
           Version: 1.2.6
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: informatique.internet at fiducial.fr
         QAContact: mono-bugs at ximian.com
          Found By: ---


Try this program :
using System;
using System.IO;
using System.Threading;
using System.Diagnostics;


namespace TestMono
{
        class MainClass
        {


                private static System.Threading.Timer tmrThreadingTimer;

                public static void Main(string[] args)
                {
                       
Console.WriteLine(Mono.Unix.UnixProcess.GetCurrentProcessId());
                        MainClass main=new MainClass();
                        main.Test();
                        Console.ReadLine();
                }

                public void Test()
                {
                        Timer tmrThreadingTimer = new
System.Threading.Timer(new 
                       TimerCallback(tmrThreadingTimer_TimerCallback),
                       null, System.Threading.Timeout.Infinite, 5000);
                        tmrThreadingTimer.Change(0, 5000);
                }

                private static void tmrThreadingTimer_TimerCallback(object
state) {
                        try{
                        Console.WriteLine("Mise à jour base de donnée
d'indexation en cours...");
                        }catch(Exception e)
                        {
                        }

                }

Result :
4025
Mise à jour base de donnée d'indexation en cours...
Mise à jour base de donnée d'indexation en cours...

take a look on 
mono --wapi=hps | grep 4025
hubert at hublinux ~ $ mono --wapi=hps | grep 4025
  a (  1) [Process]    0 Un ([             TestMono.exe] pid:  4025 exit: 0)
  e (  1) [ Thread]    0 Un (proc: 4025, tid: 1076369616, state: 0, exit: 0,
join: 0)
 11 (  1) [ Thread]    0 Un (proc: 4025, tid: 1088580496, state: 0, exit: 0,
join: 0)
 13 (  1) [ Thread]    0 Un (proc: 4025, tid: 1090227088, state: 0, exit: 0,
join: 0)
 14 (  1) [ Thread]    0 Sg (proc: 4025, tid: 1091279760, state: 1, exit: 0,
join: 0)
 16 (  1) [ Thread]    0 Sg (proc: 4025, tid: 1092332432, state: 1, exit: 0,
join: 0)
 18 (  1) [ Thread]    0 Sg (proc: 4025, tid: 1091279760, state: 1, exit: 0,
join: 0)
 1a (  1) [ Thread]    0 Sg (proc: 4025, tid: 1092332432, state: 1, exit: 0,
join: 0)
 1b (  1) [ Thread]    0 Un (proc: 4025, tid: 1091279760, state: 0, exit: 0,
join: 0)

There's a line more each the timer is triggered...

Remark : This bug appear only if the timer period is > 5s

Thanks to correct this and backport to 1.2.6 branch


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list