title: Token leak in managed Window service
body: <p>I have WCF service hosted in a window service.I was observing some handle leaks by this service.On investigating i was able to find that the reason for the leak are the DB operation performed on *.accdb(MS acsess) file.To rule out the other possiblities(with WCF etc.) i have created a test Window service in c# and in its Onstart method I have started a thread in which I call Open and close on the database and i still see the token leak. The service is runing is Local System account and the db fiel is present in the local computer.The open and close are sucessful. Three or four tokens of the given type gets generated every time i call Open on the database and count doesnot reduce on close.So they keep on increasing.When i run the service as the logged on user i dont see the meory leak</p>
  
  <pre><code>protected override void OnStart(string[] args)
                  {
                      ThreadStart t = new ThreadStart(DBConenctionThread);
                      Thread t2 = new Thread(t);
                      t2.Start();
                  }
  
  void DBConenctionThread()
          {
              bool b = true;
              String s = @"Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=D:\testdatabase\tempelate2.accdb;Uid=;Pwd=;";
              while (b)
              {
                  try
                  {
                      using (OdbcConnection dbConnection = new OdbcConnection(s))
                      {
  
                          dbConnection.Open();
                          dbConnection.Close();
  
                      }
                  }
                  catch (NotSupportedException ex)
                  {
  
                  }
                  catch (Exception ex)
                  {
                  }
              }
          }
  </code></pre>
  
  <p>These are the details for the token being leaked from the process explorer</p>
  
  <p>Name : NT AUTHORITY\SYSTEM:3e7
  Type : token
  Description : identifies a security context.</p>