<p>As far as I can test the issue is in <code>imaplib2</code> line 2649:</p>

<pre><code>self.sock.shutdown(socket.SHUT_RDWR)
</code></pre>

<p>The problem does not happen when only closing the writer side using <code>SHUT_WR</code>. This means for some reason the reader side has been shutdown. I cannot see why.</p>

<p>Is there a reason shutting down both sides since the <code>finally</code> block does a <code>close()</code>?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/OfflineIMAP/offlineimap/issues/205#issuecomment-153480214">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AKFSEApfBXCyOMx6BAbDF3QzhcQBShotks5pCRKkgaJpZM4EjkWN.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/OfflineIMAP/offlineimap/issues/205#issuecomment-153480214"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>