Mathjs: MathJS web service down

Created on 18 Dec 2020  路  13Comments  路  Source: josdejong/mathjs

I can't run any operation against the restful API. I'm getting a 500 Internal server error and this is more frequently since the last few weeks.

Most helpful comment

(Service is up again)

All 13 comments

Thanks for reporting Marcus.

I indeed see a couple of very busy peeks on the service last weeks, the current one was the heaviest so far. I'm not yet sure what the underlying cause is, will investigate.

(Service is up again)

I see it happened again last night, a few hours until midnight (then Heroku restarts the application).

I've now deployed an older version from before this instability started to see whether the issues are gone then.

I've now put a rate limiter in place. Still needs some more refinement to make sure one user cannot overload the service.

thanks @josdejong .

Hi Jos,

Not sure if this is the right thread but I'm using Bubble to post API call. Was working really good but since yesterday it's not working anymore. With Bookabus we use it calculate price quotes so quite an important part of our business. I'm also getting the 500 internal service error (https://trip.bookabus.eu/booking/1607612050147x352120531924500700?lang=nl_nl - view console) but when I initialise the call I get a 400 error saying "Required field "expr" missing in JSON body.". The expression is still in the JSON body as I didn't change anything but it just stopped working. I don't know how to proceed or if there's anything you can do but I hope it will be fixed soon and would be good to share any feedback.

Vriendelijke groet,

Arjen Dekker

Hm I'm sorry to hear that Arjen.

I've indeed replaced the way the body of a POST request is parsed with the body-parser library of expressjs, having set a maximum document size for protection. It may be that the body-parser is a bit more strict regarding headers that are being send along. At least the format of the body is not changed. Are you passing content-type: application/json?

At the bottom of the page https://api.mathjs.org/ you can also execute an example POST request, maybe that helps debugging.

Hi Jos,

I wasn't passing the content -type. I added it as a header and now it works again :)

Thanks so much for your fast response and offering the solution!

Take care,

Arjen

Good to hear! I'll see whether I can improve the application to give back more informative errors

Please beware that this web service is meant as a free service to get started easily, it has no guarenteed uptime. If your business depend on it it may be wise to do calculations on your own backend.

I've added more logging, alarms, rate limiting, and some other stability improvements. The service has been stable for quite some time now. Looking at all the logs, it looks like the issue was not caused by a single user overloading the service, but by the service getting unstable after a restart when there where a lot of requests queued during the restart. I made some improvements in that regard which seems to work 馃槃 .

I've added more logging, alarms, rate limiting, and some other stability improvements. The service has been stable for quite some time now. Looking at all the logs, it looks like the issue was not caused by a single user overloading the service, but by the service getting unstable after a restart when there where a lot of requests queued during the restart. I made some improvements in that regard which seems to work 馃槃 .

Great job @josdejong !!! Thanks for your hard work on it!

Thanks 馃槉

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lwirtz picture lwirtz  路  3Comments

zzzgit picture zzzgit  路  4Comments

skgadi picture skgadi  路  3Comments

zcohan picture zcohan  路  4Comments

piotr-s-brainhub picture piotr-s-brainhub  路  3Comments