# HTTP -- 502 Bad Gateway

**URL:** <https://ask.openrouteservice.org/t/http-502-bad-gateway/1258>\
**Category:** matrix\
**Created:** [January 14, 2020, 1:02pm UTC](https://ask.openrouteservice.org/t/http-502-bad-gateway/1258 "2020-01-14T13:02:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chlodovech](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/chlodovech/32/352_2.png) [@Chlodovech](https://ask.openrouteservice.org/u/Chlodovech)\
**Post date:** [January 14, 2020, 1:02pm UTC](https://ask.openrouteservice.org/t/http-502-bad-gateway/1258/1 "2020-01-14T13:02:04Z")

</div>

Dear ORS,

Recently I’ve experienced a lot of 502 bad gateway errors around the Matrix API. It looks to me as if a reply from a proxy is timing out, as the 502 happens consistently at the 1 minute mark (1.09s).

 ![06](https://ask.openrouteservice.org/uploads/default/original/1X/75d4a71fae29287fc3818ed3996803df4b738ec4.png)

So far I’ve seen that using a smaller matrix size 6x6 is working as it takes less time to resolve.  
Am I doing something wrong?

A sample of my original query:

{  
“locations”: [[4.938574,52.404254],[6.416581,52.530271],[4.392741,52.057036],[5.088932,51.739693],[6.572343,53.008928],[4.871871,51.660023],[4.780813,52.155521],[5.18499,51.586974],[5.085441,51.577416],[5.779177,51.742695],[4.861313,51.947939],[6.660562,52.351922],[5.555264,51.615665],[5.693136,51.458575],[6.759829,52.243913],[4.950915,51.843195],[4.466534,52.134268],[4.291974,51.53868],[5.938097,51.635522],[5.844193,50.99651],[4.506073,52.048609],[5.316014,51.864191],[6.088112,53.109017],[4.769521,51.60141],[4.440487,52.209215],[6.504089,53.335411],[4.3094,51.849874],[5.069207,52.499906],[6.762564,52.244023],[5.939294,52.933121],[5.847102,51.833609],[5.073786,51.682315],[5.067633,51.589288],[6.377426,51.891431],[4.997931,52.518493],[6.27141,51.973671]],  
“metrics”: [“distance”, “duration”],  
“units”: “m”  
}

---

<div class="post-metadata">

**Author:** ![Alekos92](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/alekos92/32/351_2.png) [@Alekos92](https://ask.openrouteservice.org/u/Alekos92)\
**Post date:** [January 14, 2020, 10:23pm UTC](https://ask.openrouteservice.org/t/http-502-bad-gateway/1258/2 "2020-01-14T22:23:06Z")

</div>

I am also experiencing the same issue.

It has been days now.

Hopefully it’s going to be addressed soon.

---

<div class="post-metadata">

**Author:** ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)\
**Post date:** [January 15, 2020, 12:40pm UTC](https://ask.openrouteservice.org/t/http-502-bad-gateway/1258/3 "2020-01-15T12:40:16Z")

</div>

I think we found the issue, now we just have to hot-fix it. We’ll update the open threads once it’s fixed.

---

<div class="post-metadata">

**Author:** ![Chlodovech](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/chlodovech/32/352_2.png) [@Chlodovech](https://ask.openrouteservice.org/u/Chlodovech)\
**Post date:** [January 15, 2020, 3:30pm UTC](https://ask.openrouteservice.org/t/http-502-bad-gateway/1258/4 "2020-01-15T15:30:56Z")

</div>

Thank you for the reply Nils! That might have just saved my thesis 😛

Cheers!

---

<div class="post-metadata">

**Author:** ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)\
**Post date:** [January 15, 2020, 3:34pm UTC](https://ask.openrouteservice.org/t/http-502-bad-gateway/1258/5 "2020-01-15T15:34:31Z")

</div>

Oops;) Well, if you need it only for a smallish region like Baden-Württemberg/half a country, you can always quickly install it yourself:

> **[openrouteservice/docker at master · GIScience/openrouteservice](https://github.com/GIScience/openrouteservice/tree/master/docker)**
>
> master/docker

Interestingly it’s all fine that way, at least for `driving-*` profiles. `foot-walking` is somehow super slow, even locally.

---

<div class="post-metadata">

**Author:** ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)\
**Post date:** [January 16, 2020, 3:12pm UTC](https://ask.openrouteservice.org/t/http-502-bad-gateway/1258/6 "2020-01-16T15:12:54Z")

</div>

fixed nowwwwwwwwwwww

---

<div class="post-metadata">

**Author:** ![Chlodovech](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/chlodovech/32/352_2.png) [@Chlodovech](https://ask.openrouteservice.org/u/Chlodovech)\
**Post date:** [January 20, 2020, 8:45am UTC](https://ask.openrouteservice.org/t/http-502-bad-gateway/1258/7 "2020-01-20T08:45:05Z")

</div>

Cheers Nils, You guys are amazing!

---

<div class="post-metadata">

**Author:** ![anderssv](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/anderssv/32/526_2.png) [@anderssv](https://ask.openrouteservice.org/u/anderssv)\
**Post date:** [May 7, 2020, 3:06pm UTC](https://ask.openrouteservice.org/t/http-502-bad-gateway/1258/8 "2020-05-07T15:06:54Z")

</div>

So we got some 502s repeatedly for one set of points today. About 1:45PM Oslo time today if that helps anything. 🙂

---

<div class="post-metadata">

**Author:** ![adam](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/adam/32/8_2.png) [@adam](https://ask.openrouteservice.org/u/adam)\
**Post date:** [May 8, 2020, 5:48am UTC](https://ask.openrouteservice.org/t/http-502-bad-gateway/1258/9 "2020-05-08T05:48:11Z")

</div>

It seems that the car profile has been under heavy load from matrix and isochrone requests lately, so when too many are asked for at the same time, they basically hog all of Tomcat’s threads until the tasks are complete, thus giving the timeout. When multiple heavy requests are run one after the other, then it basically blocks the system indefinitely. I’ve just restarted the car server now so hopefully if some threads got stuck somewhere that will will release them
