Skip to content

Commit fba1a8a

Browse files
authored
Fix bounded channel being too small (#1747)
* Fix bounded channel being too small * PR link
1 parent a6c2b5b commit fba1a8a

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

light-base/src/json_rpc_service.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,16 @@ pub struct Config<TPlat: PlatformRef> {
7070
///
7171
/// This parameter is necessary in order to prevent users from using up too much memory within
7272
/// the client.
73+
// TODO: unused at the moment
7374
pub max_pending_requests: NonZeroU32,
7475

7576
/// Maximum number of active subscriptions. Any additional subscription will be immediately
7677
/// rejected.
7778
///
7879
/// This parameter is necessary in order to prevent users from using up too much memory within
7980
/// the client.
80-
pub max_subscriptions: u32,
81-
82-
/// Maximum number of JSON-RPC requests that can be processed simultaneously.
83-
///
84-
/// This parameter is necessary in order to prevent users from using up too much memory within
85-
/// the client.
8681
// TODO: unused at the moment
87-
pub max_parallel_requests: NonZeroU32,
82+
pub max_subscriptions: u32,
8883
}
8984

9085
/// Creates a new JSON-RPC service with the given configuration.
@@ -96,7 +91,7 @@ pub struct Config<TPlat: PlatformRef> {
9691
pub fn service<TPlat: PlatformRef>(config: Config<TPlat>) -> (Frontend<TPlat>, ServicePrototype) {
9792
let log_target = format!("json-rpc-{}", config.log_name);
9893

99-
let (requests_tx, requests_rx) = async_channel::bounded(32); // TODO: capacity?
94+
let (requests_tx, requests_rx) = async_channel::unbounded(); // TODO: capacity?
10095
let (responses_tx, responses_rx) = async_channel::bounded(16); // TODO: capacity?
10196

10297
let frontend = Frontend {

light-base/src/lib.rs

-7
Original file line numberDiff line numberDiff line change
@@ -935,13 +935,6 @@ impl<TPlat: platform::PlatformRef, TChain> Client<TPlat, TChain> {
935935
log_name: log_name.clone(), // TODO: add a way to differentiate multiple different json-rpc services under the same chain
936936
max_pending_requests,
937937
max_subscriptions,
938-
// Note that the settings below are intentionally not exposed in the publicly
939-
// available configuration, as "good" values depend on the global number of tasks.
940-
// In other words, these constants are relative to the number of other things that
941-
// happen within the client rather than absolute values. Since the user isn't
942-
// supposed to know what happens within the client, they can't rationally decide
943-
// what value is appropriate.
944-
max_parallel_requests: NonZeroU32::new(24).unwrap(),
945938
});
946939

947940
service_starter.start(json_rpc_service::StartConfig {

wasm-node/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Fixed
6+
7+
- Fix `QueueFullError` being thrown even when the number of requests is way below the value passed to `jsonRpcMaxPendingRequests`. ([#1747](https://github.com/smol-dot/smoldot/pull/1747))
8+
59
## 2.0.23 - 2024-03-20
610

711
### Changed

0 commit comments

Comments
 (0)