JeremyTsaii/leetcode-stats-api

Heroku 500 internal server error

Opened this issue · 2 comments

image

My organization/club has been using the api for a leaderboard. When 50+ api calls are made within 10mins, all users get this error when trying to load the page. Reloading the page results in the same error for about 5-10mins, after which it goes back to normal.

I looked into the issue and found that this is largely an issue with Heroku. It limits max threads to 256 for the base plan. The request builder in the ServiceImpl creates threads but waits for java to clean them up, so if many requests are made in succession before Java cleans up the threads, Heroku will refuse to assign more, leading to a 500 internal server error.

@stevenewald host it in your own env