From 89398f3aca52735f73ce7c290b073b5e7ac00021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Tue, 18 Oct 2022 14:13:53 +0200 Subject: [PATCH 1/3] Add timeout for HTTP connections --- server/rpc.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/rpc.go b/server/rpc.go index d89df3e3d4..b9679b053e 100644 --- a/server/rpc.go +++ b/server/rpc.go @@ -36,6 +36,7 @@ import ( const GRPCConnectTimeout = 3 * time.Second const GRPCTimeout = 8 * time.Second +const HTTPTimeout = 8 * time.Second var authTokenValidPeriod = 30 * time.Minute var discoveryAuthWebhookCacheCleanup = 5 * time.Minute @@ -203,11 +204,10 @@ func StartTranscodeServer(orch Orchestrator, bind string, mux *http.ServeMux, wo glog.Info("Listening for RPC on ", bind) srv := http.Server{ - Addr: bind, - Handler: &lp, - // XXX doesn't handle streaming RPC well; split remote transcoder RPC? - //ReadTimeout: HTTPTimeout, - //WriteTimeout: HTTPTimeout, + Addr: bind, + Handler: &lp, + ReadTimeout: HTTPTimeout, + WriteTimeout: HTTPTimeout, } return srv.ListenAndServeTLS(cert, key) } From cbdebe66d5df31682824bb5405e54f831f6c3896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Wed, 19 Oct 2022 11:13:58 +0200 Subject: [PATCH 2/3] Use IdleTimeout to prevent hanging HTTP conenctions when B does not use O --- server/rpc.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/rpc.go b/server/rpc.go index b9679b053e..b2342827aa 100644 --- a/server/rpc.go +++ b/server/rpc.go @@ -204,10 +204,9 @@ func StartTranscodeServer(orch Orchestrator, bind string, mux *http.ServeMux, wo glog.Info("Listening for RPC on ", bind) srv := http.Server{ - Addr: bind, - Handler: &lp, - ReadTimeout: HTTPTimeout, - WriteTimeout: HTTPTimeout, + Addr: bind, + Handler: &lp, + IdleTimeout: HTTPTimeout, } return srv.ListenAndServeTLS(cert, key) } From 8ebeb3260181cd8bd0b3e604bb93f1d0b9ec5dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Leszko?= Date: Wed, 19 Oct 2022 11:17:39 +0200 Subject: [PATCH 3/3] Update CHANGELOG_PENDING.md --- CHANGELOG_PENDING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index e2c536a40f..e6d648ad5d 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -30,5 +30,6 @@ #### Orchestrator - [#2591](https://github.com/livepeer/go-livepeer/pull/2591) Return from transcode loop if transcode session is ended by B (@yondonfu) - [#2592](https://github.com/livepeer/go-livepeer/pull/2592) Enable Orchestrator to set pricing by broadcaster ETH address +- [#2628](https://github.com/livepeer/go-livepeer/pull/2628) Use IdleTimeout to prevent hanging HTTP connections when B does not use O (fix "too many files open" error) (@leszko) -#### Transcoder \ No newline at end of file +#### Transcoder