Skip to content

Use unsync cache + async-aware sync primitives#2164

Merged
svyatonik merged 2 commits intorevive-new-clientfrom
switch-to-async-sync-primitives
May 30, 2023
Merged

Use unsync cache + async-aware sync primitives#2164
svyatonik merged 2 commits intorevive-new-clientfrom
switch-to-async-sync-primitives

Conversation

@svyatonik
Copy link
Copy Markdown
Contributor

@svyatonik svyatonik commented May 29, 2023

fix #2146

I've found that the sync Cache from the quick_cache crate is using parking_lot primitives internally. It doesn't work well with async code (be it tokio or the async_std environment), because it can block the executor threads or cause deadlocks. So I've removed usage of sync Cache and switched to unsync Cache and async_std synchrnonization primitives.

Currently testing if it fixes the new-client issue (#2146).

@svyatonik svyatonik added A-bug Something isn't working P-Relay labels May 29, 2023
@svyatonik svyatonik merged commit df7a338 into revive-new-client May 30, 2023
@svyatonik svyatonik deleted the switch-to-async-sync-primitives branch May 30, 2023 07:25
svyatonik added a commit that referenced this pull request May 30, 2023
* Revert "Revert new client (#2153)"

This reverts commit 17cf7b5.

* add comment re cache to CachingClient (#2162)

* do not wait for reader when sending items (#2163)

* Use unsync cache + async-aware sync primitives (#2164)

* use unsync cache + async-aware sync primitives

* clippy

* trigger CI

* Revert "trigger CI"

This reverts commit b5c1405.
svyatonik pushed a commit that referenced this pull request Jul 17, 2023
* Increase delay for pov-recovery

* Update client/service/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Comment

* FMT

* Clear waiting_recovery when block is recovered or recovery failed

* Introduce recovery queue that preserved insertion order

* Better error logs

* Decrease slot duration

* Style improvements

* Add option to use unordered queue

* Maintain cache of finalized blocks

* Wait for one relay chain slot before recovery

* Make retries testable

* fmt

* Improve docs

* Improve docs

* Simplify RecoveryQueue

* Remove unwanted changes

* Adjust to comments

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* Move recovery delay into the queue

* Check for finalized number

* Clean up

* Use timer

Co-authored-by: Bastian Köcher <git@kchr.de>

* Simplify implementation

* Revert "Use timer"

This reverts commit 3809eed840d3a09d54212f99486782ff80cdc1c9.

* Properly clear `to_recover` flag

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
bkontur pushed a commit that referenced this pull request May 7, 2024
* Revert "Revert new client (#2153)"

This reverts commit 17cf7b5.

* add comment re cache to CachingClient (#2162)

* do not wait for reader when sending items (#2163)

* Use unsync cache + async-aware sync primitives (#2164)

* use unsync cache + async-aware sync primitives

* clippy

* trigger CI

* Revert "trigger CI"

This reverts commit b5c1405.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-bug Something isn't working P-Relay

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants