-
Notifications
You must be signed in to change notification settings - Fork 173
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
[http client]: refactor with "syncronous-like" design #156
Changes from 25 commits
d637b8d
3581cce
b278010
10cfe8c
cf12a2f
0b569f7
3e2827d
a453d99
1740d2e
dd72e6a
a904bc2
5d06d5d
6a43545
a6d9493
c1ebc08
a3ae6ea
be70049
19c6c9c
58bb1cc
d4c0bcc
77a9fe5
fee846f
0714a11
1929b08
a3d6355
9ef8736
e1d7f3c
abc81c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,14 +26,14 @@ | |
|
||
use async_std::task; | ||
use futures::channel::oneshot::{self, Sender}; | ||
use jsonrpsee::client::HttpClient; | ||
use jsonrpsee::client::{HttpClient, HttpConfig}; | ||
use jsonrpsee::http::HttpServer; | ||
use jsonrpsee::types::jsonrpc::{JsonValue, Params}; | ||
|
||
const SOCK_ADDR: &str = "127.0.0.1:9933"; | ||
const SERVER_URI: &str = "http://localhost:9933"; | ||
|
||
#[async_std::main] | ||
#[tokio::main] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious: why switch to Tokio here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If we go ahead with this change it should be clearly documented or spawn a background thread for it again. |
||
async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
env_logger::init(); | ||
|
||
|
@@ -44,7 +44,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { | |
|
||
server_started_rx.await?; | ||
|
||
let client = HttpClient::new(SERVER_URI); | ||
let client = HttpClient::new(SERVER_URI, HttpConfig::default())?; | ||
let response: Result<JsonValue, _> = client.request("say_hello", Params::None).await; | ||
println!("r: {:?}", response); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my machine it seems to block after the first run, looks like this:
It's stuck on the last one. Is that what you see too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I can take look what's going on there today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like a deadlock ☠️, probably some channel that is full ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found the problem https://github.com/paritytech/jsonrpsee/blob/v2/src/ws/transport.rs#L352, it essentially just allows 8 concurrent tasks to be handled per connection, and if the buffer gets full -> deadlock