Time out in Plumber API

Hello! I am facing an issue with the beta RStudio Connect. Since some days ago my plumber API I have deployed is not working properly, when before it was fine. My API needs several minutes (around 4 minutes) to send back a response but I am receiving a 504 error timeout after 1 minute of making the request. I have changed runtime settings but it is still not working.
I have created this API for my thesis, which I am defending in one week.

Any idea how to make it work?


Depending on which framework you use to call your API, there might be a default timeout setting at 1 minute. If your API needs more time than that to respond, increase the default timeout.

I'll take a look in the documentation and make some tests and and see if I can replicate. I'll let you know.

Are you expecting your API to take 4 minutes to respond or this is new behavior?

Thanks for answering. I am doing text mining and I am loading a very big amount of data, so it takes some time to process and make the analysis. That is why it takes too long.
When I was testing Beta RStudio Connect with this API some weeks ago, it was taking around its 4 minutes or more, so it is expected to be like that.

My current settings are (still not working):

  • Max processes: 3
  • Min processes: 0
  • Max connections per process: 50
  • Load factor: 0.00
  • Idle Timeout per process: 1200
  • Initial timeout: 3000
  • Connection timeout: 0
  • Read timeout: 3000

Thank you so much :slight_smile:

Are you then using Swagger UI to interact with your API after that or you call it from another client? I'm trying to establish which component triggers the timeout.

If you are able to access the Swagger UI of your API it means the API was loaded and the timeout originate from your endpoint expression execution.

Yes, I am testing it with Swagger UI, my web application and Postman as well, all of them getting same response with timeout. After I get a 504 Gateway Time-out, I can not access to Swagger UI, it will get available after several minutes have passed...

Someone with better understanding of rstudio connect inner work should jump in have a chat with your rstudio connect admin. From what you describe, it seems your request is still being executed (thus preventing you from accessing the UI).

It might also be related to deployment configuration of your rstudio connect if it is behind a proxy. I don't think I can help you more than that. Your API does not seems to be the problem.

Okay, anyway thank you so much for your help :blush:
Also if I look to the log from the execution of that request I can see that it is actually been executed and even it finishes (I have some prints in the code so it is showing when it finished).

Any idea who I may contact with to ask about this?

Oh, I get it. You are using the testing environnement at https://beta.rstudioconnect.com. It makes sense

That seems like an unreliable environment to run a thesis on, I'm sorry. The timeout is probably set at the server level and is controlled by RStudio, not something you can do something about I believe.

Please remember this is only a preview of RStudio Connect.

So in the end I hace refactored my R code and now it is completly fine. It is working as expected and I am receiving my response inside that minute.
Anyway, thank you so much for your interest on this :slight_smile:

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.