-
Notifications
You must be signed in to change notification settings - Fork 125
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
Remove future block_on
to update to jsonrpsee v17+
#692
Comments
block_on
block_on
to update to jsonrpsee v17+
Marking this as a bug, because I'm not sure if this may cause problems we simply haven't detected yet. It only revealed itself because jsonrpsee switched to oneshot channels from tokio in v17. There may be problems however with other block_ons, like in the subscription function. |
I've experimented a little with tokio and
Problems I encountered during implementing a sync interface:
All in all, it will be quite a fragile setup, that either needs us to implement a very robust interface, catching all possible user variations (using multi-threaded tokio, single thread and so on) or a solution the needs a very robust user code, e.g. never use tokio multi runtime or spawn a thread whenever a node request is issued.... The bad thing: Such tokio errors result in runtime errors, not compilation. My conclusion: The cleanest solution would be to implement a sync interface of jsonrspee itself, or remove the sync jsonrpsee interface completely for now. |
Hmmm, that's annoying that the |
I would also say, let's remove the support for sync jsonrpsee. As long as we have clear examples, how the api-client can be used for a sync-usecase, I think it should be fine. So, generally I would rather make sure we have clear examples for different usecases, and not provide solutions, that are unstable / only work with specific setups. |
While trying to update the jsonrpsee client to a newer version (#671), the client (most likely) deadlocked itself after 59 requests (see https://github.com/scs/substrate-api-client/actions/runs/7126321622/job/19404332411). This is because we are using
future::executor::block_on
within tokio runtime to make async code synchronous. More info: paritytech/jsonrpsee#1259To ensure this deadlock does not happen, I currently see two options:
Example replacement:
Old code:
New code (didn't find a better way yet, should be improved):
The text was updated successfully, but these errors were encountered: