Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bounded channel being too small #1747

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions light-base/src/json_rpc_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,16 @@ pub struct Config<TPlat: PlatformRef> {
///
/// This parameter is necessary in order to prevent users from using up too much memory within
/// the client.
// TODO: unused at the moment
pub max_pending_requests: NonZeroU32,

/// Maximum number of active subscriptions. Any additional subscription will be immediately
/// rejected.
///
/// This parameter is necessary in order to prevent users from using up too much memory within
/// the client.
pub max_subscriptions: u32,

/// Maximum number of JSON-RPC requests that can be processed simultaneously.
///
/// This parameter is necessary in order to prevent users from using up too much memory within
/// the client.
// TODO: unused at the moment
pub max_parallel_requests: NonZeroU32,
pub max_subscriptions: u32,
}

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

let (requests_tx, requests_rx) = async_channel::bounded(32); // TODO: capacity?
let (requests_tx, requests_rx) = async_channel::unbounded(); // TODO: capacity?
let (responses_tx, responses_rx) = async_channel::bounded(16); // TODO: capacity?

let frontend = Frontend {
Expand Down
7 changes: 0 additions & 7 deletions light-base/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -935,13 +935,6 @@ impl<TPlat: platform::PlatformRef, TChain> Client<TPlat, TChain> {
log_name: log_name.clone(), // TODO: add a way to differentiate multiple different json-rpc services under the same chain
max_pending_requests,
max_subscriptions,
// Note that the settings below are intentionally not exposed in the publicly
// available configuration, as "good" values depend on the global number of tasks.
// In other words, these constants are relative to the number of other things that
// happen within the client rather than absolute values. Since the user isn't
// supposed to know what happens within the client, they can't rationally decide
// what value is appropriate.
max_parallel_requests: NonZeroU32::new(24).unwrap(),
});

service_starter.start(json_rpc_service::StartConfig {
Expand Down
4 changes: 4 additions & 0 deletions wasm-node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Fixed

- 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))

## 2.0.23 - 2024-03-20

### Changed
Expand Down
Loading