Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6548775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:00:39+00:00 2026-05-25T12:00:39+00:00

I have an iPhone app that is using web services implemented in Python, using

  • 0

I have an iPhone app that is using web services implemented in Python, using Django and Piston, running on an apache server through WSGI.

Sometimes the app closes its connection to the server before a call is finished. When it does this it causes a:

[Tue Sep 06 11:29:46 2011] [error] [client 207.35.164.99] mod_wsgi (pid=820): Exception occurred processing WSGI script 'myscript.wsgi'.
[Tue Sep 06 11:29:46 2011] [error] [client 207.35.164.99] IOError: failed to write data

to appear in my server’s error logs.

I can “fix” the problem in the app by not explicitly closing the connection, but just leaving it to finish downloading and ignoring the result. However, I’d like fix this on the server-side if possible. How can I do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:00:40+00:00Added an answer on May 25, 2026 at 12:00 pm

    [disclaimer: this is a “why it can’t be easily done” explanation, not a solution]

    As @Slott pointed out, this is definitely the technically correct behavior when stream.close or stream.write is called on a closed socket. However, I understand the motivation for the question… in the context of a wsgi app, clients terminating the connection after a full or partial read is not an “exceptional” behavior, it happens all the time. For it to be left unhandled leaves the impression it was unexpected / the code was unprepared for this, when in fact it’s expected, and shouldn’t be worthy of note. So it’d be nice to fix.

    The catch is that you’d have to find a way to distinguish cases…

    • Situations like “client read ‘Status: 304’, and then closed connection” or “client read all bytes, and then closed connection, even though it had requested connection should be reused” are ones where it would be appropriate to not issue any sort of logging besides a log.debug() call.

    • But situations like “client stopped reading in the middle of file because connection died when an ISP router had a stroke” are worthy of an error being logged. Something didn’t successfully complete, and any transactional state your server app builtup should be rolled back. In which case IOError propagating upwards is the right thing to do.

    Such errors are only silenceable if at every place they could be raised, the code is modified to distinguish those two cases. Until then, the wsgi authors seem to have erred on the side of caution. So there isn’t a quick fix for this that I know of.


    (Also, I should note this isn’t django-specific, I use paste+pylons and have the same thing happen)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app [iphone], that sends to a server some times [using json],
I have a web app, that also has an iPhone and Android app using
I have an iPhone app that is using CoreData. I recently made some minor
I have an iPhone app that hides the status bar. However, my main view
I have an iPhone app that compiles and runs fine in the Simulator on
I have a simple iphone app that's based on the CrashLanding sample app. So
I'm writing server-side programs in PHP for an iPhone app. And I have no
Let's say I have a solution involving an iPhone app that generates some information
I have an iPhone VOIP app that copes with multi-multi transmit and receive (ie
I have a fairly simple iPhone app that downloads a set of UITableView results

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.