From ec19fb9283cc8981511b7083c9183345355d1c41 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Tue, 5 Apr 2022 18:36:31 +0200 Subject: [PATCH 1/2] refactor(log): downgrade send errors to warn These logs are most likely related to that the client terminated the connection and they come with significant overhead. --- core/src/server/helpers.rs | 4 ++-- ws-server/src/server.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/server/helpers.rs b/core/src/server/helpers.rs index d1ef7b1dfd..53e0d22b2d 100644 --- a/core/src/server/helpers.rs +++ b/core/src/server/helpers.rs @@ -134,7 +134,7 @@ impl MethodSink { }; if let Err(err) = self.tx.unbounded_send(json) { - tracing::error!("Error sending response to the client: {:?}", err); + tracing::warn!("Error sending response {:?}", err); false } else { true @@ -153,7 +153,7 @@ impl MethodSink { }; if let Err(err) = self.tx.unbounded_send(json) { - tracing::error!("Could not send error response to the client: {:?}", err) + tracing::warn!("Error sending response {:?}", err); } false diff --git a/ws-server/src/server.rs b/ws-server/src/server.rs index 8894b645bb..5e1b2872bd 100644 --- a/ws-server/src/server.rs +++ b/ws-server/src/server.rs @@ -315,7 +315,7 @@ async fn background_task( if let Some(response) = rx.next().await { // If websocket message send fail then terminate the connection. if let Err(err) = send_ws_message(&mut sender, response).await { - tracing::error!("WS transport error: {:?}; terminate connection", err); + tracing::warn!("WS send error: {}; terminate connection", err); break; } } else { @@ -362,7 +362,7 @@ async fn background_task( } // These errors can not be gracefully handled, so just log them and terminate the connection. MonitoredError::Selector(err) => { - tracing::error!("WS transport error: {:?} => terminating connection {}", err, conn_id); + tracing::warn!("WS error: {}; terminate connection {}", err, conn_id); sink.close(); break Err(err.into()); } @@ -567,7 +567,7 @@ async fn background_task( let results = collect_batch_response(rx_batch).await; if let Err(err) = sink.send_raw(results) { - tracing::error!("Error sending batch response to the client: {:?}", err) + tracing::warn!("Error sending batch response to the client: {:?}", err) } else { middleware.on_response(request_start); } From e14d3203f862bb9332b5501e95fb92ec63569e5e Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Tue, 5 Apr 2022 18:53:04 +0200 Subject: [PATCH 2/2] chore(release): v0.10.1 --- CHANGELOG.md | 13 ++++++++++--- benches/Cargo.toml | 2 +- client/http-client/Cargo.toml | 6 +++--- client/transport/Cargo.toml | 6 +++--- client/ws-client/Cargo.toml | 8 ++++---- core/Cargo.toml | 4 ++-- examples/Cargo.toml | 2 +- http-server/Cargo.toml | 6 +++--- jsonrpsee/Cargo.toml | 18 +++++++++--------- proc-macros/Cargo.toml | 2 +- test-utils/Cargo.toml | 2 +- tests/Cargo.toml | 2 +- types/Cargo.toml | 2 +- ws-server/Cargo.toml | 6 +++--- 14 files changed, 43 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de45ec3587..39171e2903 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,11 @@ The format is based on [Keep a Changelog]. ## [Unreleased] -## [v0.10.0] - 2022-04-04 +## [v0.10.1] - 2022-04-05 -v0.10.0 is a release that fixes a regression in the HTTP server where the backlog was hardcoded to 128 (this is now set to 1024 by default but also configurable), introduces a couple of new APIs and a few minor bug fixes. +v0.10.1 is a release that fixes a regression in the HTTP server where the backlog was hardcoded to 128 (this is now set to 1024 by default but also configurable), introduces a couple of new APIs and a few minor bug fixes. -If your usage expects a high rate of new HTTP connections you are encouraged to update or manually configure the socket based on the traffic characteristics +If your usage expects a high rate of new HTTP connections you are encouraged to update or manually configure the socket based on the traffic characteristics. ### [Changed] - [proc macros]: only generate unsub method if not provided (#702) @@ -22,6 +22,7 @@ If your usage expects a high rate of new HTTP connections you are encouraged to - CI: try nextest [#701](https://github.com/paritytech/jsonrpsee/pull/701) - chore(deps): update tokio-util requirement from 0.6 to 0.7 [#695](https://github.com/paritytech/jsonrpsee/pull/695) - CI: Move CI script to new location [#694](https://github.com/paritytech/jsonrpsee/pull/694) +- refactor(log): downgrade send errors to warn [#726](https://github.com/paritytech/jsonrpsee/pull/726) ### [Fixed] - fix(client): close subscription when server sent `SubscriptionClosed` notification [#721](https://github.com/paritytech/jsonrpsee/pull/721) @@ -29,12 +30,18 @@ If your usage expects a high rate of new HTTP connections you are encouraged to - fix(rpc module): unsubscribe according ethereum pubsub spec [#693](https://github.com/paritytech/jsonrpsee/pull/693) - http server: fix regression set backlog to 1024 [#718](https://github.com/paritytech/jsonrpsee/pull/718) - README.MD: fix link to `ws server` [#703](https://github.com/paritytech/jsonrpsee/pull/703) +- fix(ws server): close all subscription when the connection is closed [#725](https://github.com/paritytech/jsonrpsee/pull/725) +- perf: don't send messages when client is gone [#724](https://github.com/paritytech/jsonrpsee/pull/724) ### [Added] - feat(http server): add new builder APIs `build_from_tcp` and `build_from_hyper` [#719](https://github.com/paritytech/jsonrpsee/pull/719) - feat(servers): add `SubscriptionSink::pipe_from_try_stream` to support streams that returns `Result` [#720](https://github.com/paritytech/jsonrpsee/pull/720) - feat(servers): add max_response_size [#711](https://github.com/paritytech/jsonrpsee/pull/711) +## [v0.10.0] - 2022-04-04 [YANKED] + +Yanked due to a leak when closing subscriptions in WebSocket server. + ## [v0.9.0] - 2022-02-03 v0.9.0 is technically a breaking release because of the `Debug` bound of the `IdProvider` trait changed which is used by WebSocket server. In practise it should be a non-breaking upgrade for most users. diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 8fb9007e53..a7b1bc40d9 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonrpsee-benchmarks" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies "] description = "Benchmarks for jsonrpsee" edition = "2021" diff --git a/client/http-client/Cargo.toml b/client/http-client/Cargo.toml index e1516122c1..d66b115c2f 100644 --- a/client/http-client/Cargo.toml +++ b/client/http-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonrpsee-http-client" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies ", "Pierre Krieger "] description = "HTTP client for JSON-RPC" edition = "2021" @@ -14,8 +14,8 @@ async-trait = "0.1" rustc-hash = "1" hyper = { version = "0.14.10", features = ["client", "http1", "http2", "tcp"] } hyper-rustls = { version = "0.23", optional = true } -jsonrpsee-types = { path = "../../types", version = "0.10.0" } -jsonrpsee-core = { path = "../../core", version = "0.10.0", features = ["client", "http-helpers"] } +jsonrpsee-types = { path = "../../types", version = "0.10.1" } +jsonrpsee-core = { path = "../../core", version = "0.10.1", features = ["client", "http-helpers"] } serde = { version = "1.0", default-features = false, features = ["derive"] } serde_json = "1.0" thiserror = "1.0" diff --git a/client/transport/Cargo.toml b/client/transport/Cargo.toml index fe5792e391..9e8aa9e155 100644 --- a/client/transport/Cargo.toml +++ b/client/transport/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonrpsee-client-transport" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies ", "Pierre Krieger "] description = "WebSocket client for JSON-RPC" edition = "2021" @@ -10,8 +10,8 @@ homepage = "https://github.com/paritytech/jsonrpsee" documentation = "https://docs.rs/jsonrpsee-ws-client" [dependencies] -jsonrpsee-types = { path = "../../types", version = "0.10.0", optional = true } -jsonrpsee-core = { path = "../../core", version = "0.10.0", features = ["client"] } +jsonrpsee-types = { path = "../../types", version = "0.10.1", optional = true } +jsonrpsee-core = { path = "../../core", version = "0.10.1", features = ["client"] } tracing = { version = "0.1", optional = true } thiserror = { version = "1", optional = true } futures = { version = "0.3.14", default-features = false, features = ["std"], optional = true } diff --git a/client/ws-client/Cargo.toml b/client/ws-client/Cargo.toml index b8fa7df29f..cc51202f5e 100644 --- a/client/ws-client/Cargo.toml +++ b/client/ws-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonrpsee-ws-client" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies ", "Pierre Krieger "] description = "WebSocket client for JSON-RPC" edition = "2021" @@ -10,9 +10,9 @@ homepage = "https://github.com/paritytech/jsonrpsee" documentation = "https://docs.rs/jsonrpsee-ws-client" [dependencies] -jsonrpsee-types = { path = "../../types", version = "0.10.0" } -jsonrpsee-client-transport = { path = "../transport", version = "0.10.0", features = ["ws"] } -jsonrpsee-core = { path = "../../core", version = "0.10.0", features = ["async-client"] } +jsonrpsee-types = { path = "../../types", version = "0.10.1" } +jsonrpsee-client-transport = { path = "../transport", version = "0.10.1", features = ["ws"] } +jsonrpsee-core = { path = "../../core", version = "0.10.1", features = ["async-client"] } [dev-dependencies] env_logger = "0.9" diff --git a/core/Cargo.toml b/core/Cargo.toml index 8d2ae4ef3e..ffc5baa89b 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonrpsee-core" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies "] description = "Utilities for jsonrpsee" edition = "2021" @@ -15,7 +15,7 @@ thiserror = "1" futures-channel = { version = "0.3.14", default-features = false } futures-util = { version = "0.3.14", default-features = false, optional = true } hyper = { version = "0.14.10", default-features = false, features = ["stream"] } -jsonrpsee-types = { path = "../types", version = "0.10.0"} +jsonrpsee-types = { path = "../types", version = "0.10.1"} tracing = { version = "0.1", optional = true } rustc-hash = { version = "1", optional = true } rand = { version = "0.8", optional = true } diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 80d85d0628..4433e7437b 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonrpsee-examples" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies "] description = "Examples for jsonrpsee" edition = "2021" diff --git a/http-server/Cargo.toml b/http-server/Cargo.toml index 1338c90a6f..dfee286a38 100644 --- a/http-server/Cargo.toml +++ b/http-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonrpsee-http-server" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies ", "Pierre Krieger "] description = "HTTP server for JSON-RPC" edition = "2021" @@ -13,8 +13,8 @@ documentation = "https://docs.rs/jsonrpsee-http-server" hyper = { version = "0.14.10", features = ["server", "http1", "http2", "tcp"] } futures-channel = "0.3.14" futures-util = { version = "0.3.14", default-features = false } -jsonrpsee-types = { path = "../types", version = "0.10.0" } -jsonrpsee-core = { path = "../core", version = "0.10.0", features = ["server", "http-helpers"] } +jsonrpsee-types = { path = "../types", version = "0.10.1" } +jsonrpsee-core = { path = "../core", version = "0.10.1", features = ["server", "http-helpers"] } globset = "0.4" lazy_static = "1.4" tracing = "0.1" diff --git a/jsonrpsee/Cargo.toml b/jsonrpsee/Cargo.toml index 03d573b8ec..58515e97cf 100644 --- a/jsonrpsee/Cargo.toml +++ b/jsonrpsee/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "jsonrpsee" description = "JSON-RPC crate" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies ", "Pierre Krieger "] license = "MIT" edition = "2021" @@ -12,14 +12,14 @@ documentation = "https://docs.rs/jsonrpsee" [dependencies] # No support for namespaced features yet so workspace dependencies are prefixed with `jsonrpsee-`. # See https://github.com/rust-lang/cargo/issues/5565 for more details. -jsonrpsee-http-client = { path = "../client/http-client", version = "0.10.0", package = "jsonrpsee-http-client", optional = true } -jsonrpsee-ws-client = { path = "../client/ws-client", version = "0.10.0", package = "jsonrpsee-ws-client", optional = true } -jsonrpsee-client-transport = { path = "../client/transport", version = "0.10.0", package = "jsonrpsee-client-transport", optional = true } -jsonrpsee-http-server = { path = "../http-server", version = "0.10.0", package = "jsonrpsee-http-server", optional = true } -jsonrpsee-ws-server = { path = "../ws-server", version = "0.10.0", package = "jsonrpsee-ws-server", optional = true } -jsonrpsee-proc-macros = { path = "../proc-macros", version = "0.10.0", package = "jsonrpsee-proc-macros", optional = true } -jsonrpsee-core = { path = "../core", version = "0.10.0", package = "jsonrpsee-core", optional = true } -jsonrpsee-types = { path = "../types", version = "0.10.0", package = "jsonrpsee-types", optional = true } +jsonrpsee-http-client = { path = "../client/http-client", version = "0.10.1", package = "jsonrpsee-http-client", optional = true } +jsonrpsee-ws-client = { path = "../client/ws-client", version = "0.10.1", package = "jsonrpsee-ws-client", optional = true } +jsonrpsee-client-transport = { path = "../client/transport", version = "0.10.1", package = "jsonrpsee-client-transport", optional = true } +jsonrpsee-http-server = { path = "../http-server", version = "0.10.1", package = "jsonrpsee-http-server", optional = true } +jsonrpsee-ws-server = { path = "../ws-server", version = "0.10.1", package = "jsonrpsee-ws-server", optional = true } +jsonrpsee-proc-macros = { path = "../proc-macros", version = "0.10.1", package = "jsonrpsee-proc-macros", optional = true } +jsonrpsee-core = { path = "../core", version = "0.10.1", package = "jsonrpsee-core", optional = true } +jsonrpsee-types = { path = "../types", version = "0.10.1", package = "jsonrpsee-types", optional = true } [features] client-ws-transport = ["jsonrpsee-client-transport/ws", "jsonrpsee-client-transport/tls"] diff --git a/proc-macros/Cargo.toml b/proc-macros/Cargo.toml index 1801b74e17..df48c9e580 100644 --- a/proc-macros/Cargo.toml +++ b/proc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "jsonrpsee-proc-macros" description = "Procedueral macros for jsonrpsee" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies ", "Pierre Krieger "] license = "MIT" edition = "2021" diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 877943db46..c00a6ab0fa 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonrpsee-test-utils" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies "] license = "MIT" edition = "2021" diff --git a/tests/Cargo.toml b/tests/Cargo.toml index c6fa424651..f3beb50bba 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonrpsee-integration-tests" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies "] description = "Integration tests for jsonrpsee" edition = "2021" diff --git a/types/Cargo.toml b/types/Cargo.toml index 2d254bf6a2..aad229d775 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonrpsee-types" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies "] description = "Shared types for jsonrpsee" edition = "2021" diff --git a/ws-server/Cargo.toml b/ws-server/Cargo.toml index f7e257ebcf..db663fdb6e 100644 --- a/ws-server/Cargo.toml +++ b/ws-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jsonrpsee-ws-server" -version = "0.10.0" +version = "0.10.1" authors = ["Parity Technologies ", "Pierre Krieger "] description = "WebSocket server for JSON-RPC" edition = "2021" @@ -12,8 +12,8 @@ documentation = "https://docs.rs/jsonrpsee-ws-server" [dependencies] futures-channel = "0.3.14" futures-util = { version = "0.3.14", default-features = false, features = ["io", "async-await-macro"] } -jsonrpsee-types = { path = "../types", version = "0.10.0" } -jsonrpsee-core = { path = "../core", version = "0.10.0", features = ["server"] } +jsonrpsee-types = { path = "../types", version = "0.10.1" } +jsonrpsee-core = { path = "../core", version = "0.10.1", features = ["server"] } tracing = "0.1" serde_json = { version = "1", features = ["raw_value"] } soketto = "0.7.1"