Note that there are some explanatory texts on larger screens.

plurals
  1. POCFReadStreamRead blocking forever under iOS 7
    primarykey
    data
    text
    <p>I'm seeing an issue wherein <code>CFReadStreamRead</code>, as part of a streamed file upload, <em>never</em> returns.</p> <p>This <em>seems</em> to happen only on iOS7 — and far more often when debugging against a physical device than in the simulator — or at least, it's far more evident there.</p> <p>We have an HTTP (or HTTPS, the problem occurs either way, with a locally-hosted or remote server) <code>POST</code> of a file, via straight-line, blocking (non-event-driven) CFNetwork calls. It's a necessity of the C code calling this handler; there's no provision for callbacks.</p> <p>That's well and good, the network calls are happening in background threads and/or via async dispatch.</p> <p>The network code in question boils down to (removing error handling for brevity):</p> <pre><code>CFReadStreamRef upload = CFReadStreamCreateWithFile( kCFAllocatorDefault, upload_file_url); CFRelease(upload_file_url); CFReadStreamOpen(upload); CFReadStreamRef myReadStream = CFReadStreamCreateForStreamedHTTPRequest( kCFAllocatorDefault, myRequest, upload); CFReadStreamOpen(myReadStream); CFIndex numBytesRead = CFReadStreamRead(myReadStream, buf, sizeof(buf)); // etc. </code></pre> <p>On its own, this code wants to hang immediately under iOS7. If I add a loop with some calls to <code>usleep</code> before it (checking <code>CFReadStreamHasBytesAvailable</code> along the way), it will <em>almost</em> always succeed. Every few hundred tries, it will still fail, never returning. Again, the main thread is unaffected.</p> <p>I'd hoped the GM would clear up this behavior, but it's still present. </p> <p>Adding a runloop/callback method to watch for bytes-available events has no effect - when the call hangs, no events are seen, either.</p> <p>Any suggestions as to why this is happening, or how it can be prevented? Anyone else seeing different <code>CFReadStream</code> behavior under iOS 7?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload