title: AFNetworking/NSURLConnection receiving NSPOSIXErrorDomain Code=9 "The operation couldn’t be completed. Bad file descriptor"
body: <p>In my app which uses AFNetworking/NSURLConnection for sending requests to the server I sometimes (very rarely) see this error in operation failure block:</p>
  
  <pre><code>Error Domain=NSPOSIXErrorDomain Code=9 "The operation couldn’t be completed. Bad file descriptor"
  </code></pre>
  
  <p>At <a href="https://devforums.apple.com/message/278770#278770">https://devforums.apple.com/message/278770#278770</a> there's an answer to a similar question:</p>
  
  <blockquote>
    <p>It means that someone has been deallocating file descriptors out from underneath NSURLConnection.</p>
  </blockquote>
  
  <p>But in my own code I don't touch any streams of file descriptors in any way. It's just simple GET/POST requests.</p>
  
  <p>What could be the cause of this problem?</p>
  
  <p>Has someone encountered this error in their AFNetworking operations?</p>
  
  <p>Also, how can I close this file descriptor deliberately if I really wanted to? The answer to this question will help me to understand the problem better.</p>