Operation timed out after 30000 milliseconds with 0 bytes received


#1

Hello twitter,

using tmhoauth.php class, i’ve been posting stuff successfully for the past few weeks, but since last week, i always receive “Operation timed out after 30000 milliseconds with 0 bytes received”. This look like an error generated by tmhoauth.php when it doesn’t receive any answer from the API after the timeout has been reached.

I’ve try putting the timeout way higher and i still receive the same error.

I’m just wondering if there’s anything on twitter side that could cause this issue, but i guess this would have been reported already …

Just let me know where i can start to debug this!

thanks,


#2

Are you on shared hosting? Sometimes IP addresses get temporarily blacklisted in response to abuse.


#3

I’m not, i’m on a dedicated server! I modified my script so it automatically retry on failure, and it can sometime takes up to 20 tries before it goes through.

So the code is working fine, but it seems like the API isn’t answering back most of the time!


#4

I did a few tests under different classes (all PHP using cURL) and they all have the same issues, please note that using 1.1/statuses/update is working 100% of the time, but as soon as i add media, with 1.1/statuses/update_with_media it won’t go through.


#5

OK, that rules out IP address blacklisting I think. When you say you retry on failure – do you do so aggressively or are you using some kind of more exponential backoff?

I know of some issues some developers have when uploading media – what HTTP headers are you sending when you’re making such a request?


#6

Hello,
I am using Abraham Williams php code (https://github.com/abraham/twitteroauth) which was working perfectly,
even after the API update from 1 to 1.1.
Suddenly, the last days I rechecked the “update_with_media” method, which does not work (and it used to work).

The code is the following:

$tweet->post(‘https://api.twitter.com/1.1/statuses/update_with_media.json’,
array(
‘media[]’ => “{$image};type=image/jpeg;filename={$filename}”,
‘status’ => “my message”),
true,
true);

It is the same code, I m using the last 3 months.
Any idea?
Thank you


#7

Hi @episod, first thanks for answering. My retries are done one every 30 seconds or so, so i don’t think it’s very aggressive.

The header part is abstracted by the class so i’m not 100% sure, but here the output i receive.

(
[raw] => HTTP/1.1 100 Continue

[headers] => Array
    (
        [HTTP/1.1 100 Continue] => 
        [] => 
    )

[code] => 100
[response] => 
[info] => Array
    (
        [url] => https://api.twitter.com/1.1/statuses/update_with_media.json
        [content_type] => 
        [http_code] => 100
        [header_size] => 25
        [request_size] => 600
        [filetime] => -1
        [ssl_verify_result] => 0
        [redirect_count] => 0
        [total_time] => 10.277178
        [namelookup_time] => 1.6E-5
        [connect_time] => 0.043826
        [pretransfer_time] => 0.139648
        [size_upload] => 24428
        [size_download] => 0
        [speed_download] => 0
        [speed_upload] => 2376
        [download_content_length] => -1
        [upload_content_length] => 24428
        [starttransfer_time] => 0.183696
        [redirect_time] => 0
        [certinfo] => Array
            (
            )

        [request_header] => POST /1.1/statuses/update_with_media.json HTTP/1.1

User-Agent: app-name
Host: api.twitter.com
Accept: /
Accept-Encoding: deflate, gzip
Authorization: OAuth oauth_consumer_key="-------", oauth_nonce="------", oauth_signature="-------", oauth_signature_method=“HMAC-SHA1”, oauth_timestamp="-----", oauth_token="----", oauth_version="1.0"
Content-Length: 24428
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------024eafa72fab

    )

[error] => Operation timed out after 10000 milliseconds with 0 bytes received
[errno] => 28

)


#8

I’m having the same issue with all the classes i tested, and even with direct cURL command! Am i the only one having issues with update_with_media API using curl?


#9

I checked your code and tried it yesterday when i realized my class wasn’t working, and i had the same issue indeed. It really seems to be something that changed on the update_with_media API.

I hope Twitter will be able to fix this ASAP!


#10

Are you always sending the Expect-100: Continue HTTP header? Have you tried without?


#11

Without Expect: 100

Array
(
[raw] =>
[code] => 0
[response] =>
[info] => Array
(
[url] => https://api.twitter.com/1.1/statuses/update_with_media.json
[pretransfer_time] => 0.173398
[size_upload] => 24428
[size_download] => 0
[speed_download] => 0
[speed_upload] => 2378
[download_content_length] => -1
[upload_content_length] => 24428
[starttransfer_time] => 0.173467
[redirect_time] => 0
[certinfo] => Array
(
)

        [request_header] => POST /1.1/statuses/update_with_media.json HTTP/1.1

User-Agent: that-g33k-tweeter
Host: api.twitter.com
Accept: /
Accept-Encoding: deflate, gzip
Authorization: OAuth oauth_consumer_key="----------------", oauth_nonce="----------", oauth_signature="--------------", oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1377013132”, oauth_token="----------", oauth_version="1.0"
Content-Length: 24428
Content-Type: multipart/form-data; boundary=----------------------------1eefcca8957f

    )

[error] => Operation timed out after 10000 milliseconds with 0 bytes received
[errno] => 28

)

Same result


#12

Hi @Episod,

even after removing Expect-100, i still have the same issue!


#13

My application was working very well until today. I got same problems.

$tweet->post(‘https://api.twitter.com/1.1/statuses/update_with_media.json’,
array(
‘media[]’ => “{$image};type=image/jpeg;filename={$filename}”,
‘status’ => “my message”),
true,
true);
I use similiar codes and i am getting this error.

        [0] => stdClass Object
            (
                [code] => 195
                [message] => Missing or invalid url parameter
            )

#14

That’s a very strange error since the method doesn’t take a “url” parameter. Which library are you using? Is it doing anything special with the value you’re passing to the “media[]” parameter?


#15

Thanks, I’m continuing to look into what may be causing this.


#16

It’s the library I am using in a previous post (Abraham Williams library: https://github.com/abraham/twitteroauth ).
This code is being used the last 2-3 months with the exact parameter media[].
If media[] parameter wasn’t the right parameter, it shouldn’t work before.
Can you please provide an example with the minimum setup/parameters, in order to post an image file located on the same folder?

Thank you


#17

I’ve been looking through the twitteroauth code and trying to recreate an example; I’m not quite sure how it was working for you before in this library, as I don’t see a way in twitteroauth to:

  • explicitly set multipart content-type for the request
  • for their OAuth 1.0A signature generation code to properly take in account POST bodies of a different content-type

If this was working before with this library, it was likely due to more lenient implementations on this method.


#18

I’m having the same problem since yesterday with a code that I used since months and was always working. But now I’m lost!


#19

I get the same “Operation timed out after 10000 milliseconds with 0 bytes received” as of this morning with update_with_media.json, but the update.json works fine.


#20

Hi,
I have the same problem here yesterday (statuses/update_with_media.json) using this lib. https://github.com/themattharris/tmhOAuth/
[error] => Operation timed out after 10000 milliseconds with 0 bytes received [errno] => 28

statuses/update working perfect!!!