title: Why are sysprocesses left open on SQL Server for a long time?
body: <p>I've noticed a lot of db connections left open on my production SQL Server, some for a very long time.  Many of these have an open transaction. As seen in the query:</p>
  
  <pre><code>select * from sysprocesses where open_tran&gt;0
  </code></pre>
  
  <p>They are in status = "sleeping", cmd = "AWAITING COMMAND".</p>
  
  <p>The connections are opened using NHIBERNATE as follows:</p>
  
  <pre><code>For&lt;ISessionFactory&gt;().Singleton()
      .Use(() =&gt; DataContext.GetSessionFactory());
  
  For&lt;ISession&gt;().Transient()
    .Use(context =&gt; context.GetInstance&lt;ISessionFactory&gt;().OpenSession());
  </code></pre>
  
  <p>Some sessions use a transaction scope:
       _transactionScope = new TransactionScope();</p>
  
  <p>Some create a transaction:</p>
  
  <pre><code>_uncommittedTransaction = SessionUncommittedWrapper.Session.BeginTransaction(IsolationLevel.ReadUncommitted);
  </code></pre>
  
  <p>The transaction and/or transactionScope are disposed afterwards.</p>
  
  <p>Why are the connections still open?  And is it a problem, if nothing is being blocked?</p>