I am using the ruby twitter gem and oauth to gain access to users twitter accounts. In my code, I have:
unless @user.twitter_authd? oauth = Twitter::O
This problem seems to be caused by twitter not being able to handle connection keep-alive correctly. Make sure you set connection=close http header in the request to twitter. Wasted a weekend debugging this.
connection keep-alive
connection=close http header