fastify-reply-from icon indicating copy to clipboard operation
fastify-reply-from copied to clipboard

Cannot completely disable requestTimeout and sessionTimeout

Open gunters63 opened this issue 10 months ago • 4 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.26.2

Plugin version

9.7.0

Node.js version

v20.11.1

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

Ubuntu 20.04

Description

I have an industrial application here which uses grpc-web in the browser to communicate with a .Net backend. I use a fastify web server as a proxy to forward the HTTP/2 requests (content-type "application/grpc-web-text") to the .Net backend.

After some fiddling I got it to work with the help of @fastify/http-proxy (which uses @fastify/reply-from internally).

But I still have a somewhat exotic problem. The UI makes heavy use of Grpc subscriptions. A Grpc subscription keeps a HTTP/2 session open as long as the subscription is active.

The UI can sit idle for hours and days with the same active subscription(s), which means the default requestTimeout and sessionTimeout timeouts have to be disabled or increased.

Disabling is not possible because the code handles a timeout of 0 as undefined:

  if (!http2Opts.sessionTimeout) {
    http2Opts.sessionTimeout = opts.sessionTimeout || 60000
  }
  if (!http2Opts.requestTimeout) {
    http2Opts.requestTimeout = 10000
  }

I increased the timeouts to the maximal possible values instead (2147483647). Which means after 25 days the UI will fail if no one touches it. Which is unlikely but I don't want to rule it out.

In this use case it would best if you could completely disable the timeouts. So I propose to handle the 0 value explicitely in the code. I would also be happy to provide a merge request if this change is approved.

Link to code that reproduces the bug

No response

Expected Behavior

The user should be able to completely disable requestTimeout and sessionTimeout by providing a value of 0.

gunters63 avatar Apr 26 '24 13:04 gunters63