The Movie Database Support

Hello trying to access the api and I keep gettting a error like below:

Fatal error: Uncaught exception 'TMDbException' with message 'Server error on "http://api.themoviedb.org/3/movie//trailers?api_key=APIKEY&language=en": HTTP/1.1 503 Service Unavailable Age: 0 Content-Type: text/html; charset=utf-8 Date: Sat, 23 Feb 2013 20:00:09 GMT Retry-After: 0 Server: nginx Via: 1.1 varnish X-Cache: MISS X-Varnish: 642980785 X-Varnish-Sid: tm-v-p-1100 Content-Length: 418 Connection: keep-alive Error 503 Service Unavailable

Service Unavailable

Guru Meditation:

XID: 642980785

Varnish cache server

' in /var/www/master/TMDb2.php:870 Stack trace: #0 /var/www/master/TMDb2.php(243): TMDb->_makeCall('movie//trailers', Array) #1 /var/www/master/cache_image-trail in /var/www/master/TMDb2.php on line 870

Any information you can provided would be most appreciated.

Thanks

26 replies (on page 1 of 2)

Jump to last post

Next pageLast page

Hi Dale,

There haven't been any reported issues with any other users nor our external monitoring which makes me think you might be tripping the request rate limiting. You can read about it here:

http://help.themoviedb.org/kb/general/api-request-limits

Hello Travis,

Thank for getting back to me. OK this might explain the issue.

I will put some code into count the requests and see if I'm hitting this.

Thanks.

Dale

Hello Travis,

I have put a cap on the requests to 10 every 10 seconds and I am still getting the error message.

Could I work with you in private message to see if It is something I am doing wrong.

Thanks,

Dale.

Hello,

I pay attention to the request limit and run into the same problem. Any solution?

Thanks Frank

Hi Frank/Dale,

There are no reported issues with the API.

What are the requests you are making that throw the error?

I feel fairly confident that it pretty much has to be the rate limiting. Try limiting it more. It's not just "10 requests per second" it's "30 requests every 10 seconds", so you can burst to 30. If you use up those 30 before 10 seconds is up you will get an error until 10 seconds has passed which will reset the request counter.

Hi Travis,

I limited the requests down to 20 requests every 12 seconds and printed the timestamps of the last requests to check it myself and the limit was not exceeded. The requests are done with a PHP script using curl. It utilizes several API functions: getMovie, getMovieTranslations, getMovieCast, getMovieTitles

I will check if it is always the same function which will return the error.

Ok, let me know.

P.S. Just in case you are indeed still using 2.1 (based on those method names…), 2.1 was deprecated over a year ago and will be on the chopping block soon. If you are developing an application now, it's a waste of your time to use anything but v3.

No, it is based on V3, I've just copied the function names.

Actually I'm extending the PHP wrapper https://github.com/glamorous/TMDb-PHP-API to take care on the request limits. When it is working I will send it back to the developer.

Here are the results of the log files:


/3/movie/                                  - 6 "503" errors
/3/movie/TMDBID/translations  - 5 "503" errors
/3/movie/TMDBID/casts            - 1 "503" error

The Header is always:


Age: 0
Content-Type: text/html; charset=utf-8
Date: Mon, 18 Mar 2013 21:01:49 GMT
Retry-After: 0
Server: nginx
Via: 1.1 varnish
X-Cache: MISS
X-Varnish: 2482489717
X-Varnish-Sid: tm-v-p-1200        OR   tm-v-p-1100
Content-Length: 419
Connection: keep-alive

The Content / Body is always:


?xml version="1.0" encoding="utf-8"?>
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
html>
  head>
    title>503 Service Unavailable
  /head>
  body>
    h1>Error 503 Service Unavailable
    p>Service Unavailable
    h3>Guru Meditation:
    p>XID: 2482489717
    hr>
    p>Varnish cache server
  /body>
/html>

Here the timestamps of the 20 requests per 12 seconds:


1363647597.699
1363647599.145
1363647599.662
1363647600.009
1363647600.454
1363647600.659
1363647601.061
1363647603.471
1363647606.079
1363647606.798
1363647607.513
1363647608.176
1363647609.170
1363647609.593
1363647610.158
1363647610.846
1363647611.316
1363647612.041
1363647612.688
1363647613.444

Hey Frank,

Mind privately emailing me your IP? I'm working with out ops guy to understand what's happening here and we can have a better insight with the IP that you're using. You can email me personally at travis [at] themoviedb.org

Also, are you hitting our production API directly (api.themoviedb.org) or are you going through Apiary?

Hey guys,

I think we've tracked this down. It is indeed a load issue that we will have to address on our side. We're looking into it and will update this thread once we've attempted to fix it. Thanks for finding this and also providing so much detail. Very helpful.

There's still some work to be done but can you give your script a try and see how you make out? We did make one change that we're hoping will help until we address another larger issue.

P.S. the limiting is slightly different than I explained earlier. This didn't change, I was simply wrong with the original information.

We limit the requests to 4 requests per second with an allowable burst of 40. We restrict your connections to 8 allowed per IP.

UPDATE @ 2:02 PM MST I'm pretty sure our little gap measure has no effect. I'll update you guys once the proper fix has gone been pushed live.

Thank you frankglaser for helping proving it wasn't me going made.

Big thanks to Travis to looking into it in more detail. I currently do not have the script running as my servers are down for maintenance.

If the maintenance is finished tomorrow I will start one and see what happens.

Just want to be clear with the limits. If i have a loop that is using your site and requesting 10 movies every 10 seconds i shouldn't hit the request limit.

thanks

Dale.

Thanks for Your support Travis. I have adapted the script to handle 4 requests per second and just started it.

Can You explain, how the bursts are handled. For e.g. is one burst allowed per hour?

I'm getting the 503 error as well, but I'm pretty sure the script isn't tripping the request limits. Sometimes with the "Guru Meditation: XID: xxxxxx" message below it, sometimes without.

I tried it a few times and still getting the 503 errors.

Here are the timestamps of the 4 requests per 1 second tests:

1363942249.4478
1363942249.7137
1363942249.944
1363942250.1757
1363947526.2801
1363947526.8383
1363947527.4239
1363947534.8715

Because of the timestamps, it doesn't look like the script reaches the request limitation.

Is there any way to differ between the connection and request limit?

Can't find a movie or TV show? Login to create it.

Want to rate or add this item to a list?

Login