zebra/book
Janito Vaqueiro Ferreira Filho ebd94b2e60
Fix deadlock in chain tip watch channel (#3378)
* Avoid sequential borrows in `LatestChainTip`

Calling `watch::Receiver::borrow` more than once in the same scope can
cause a deadlock. The instrumented methods were calling `borrow` twice
to record instrumented fields.

This refactors things to ensure `borrow` is only called once to record
the fields and perform any actions with the chain tip block.

* Remove `borrow()` calls in `ChainTipChange`

Refactor to use a `LatestChainTip` instance instead, which safely
protects the internal `watch::Receiver` so that it is not borrowed more
than once in the same scope.

* Add a paragraph to the Asynchronous guide

Warn against using two borrow guards in the same scope, and describe why
that can lead to a deadlock.
2022-01-24 00:36:40 +00:00
..
src Fix deadlock in chain tip watch channel (#3378) 2022-01-24 00:36:40 +00:00
theme Use zebra favicon for zebra.zfnd.org book 2020-08-29 03:33:31 -04:00
.gitignore Add skeleton of eventual zebra book (#653) 2020-07-17 20:15:50 -07:00
book.toml Add skeleton of eventual zebra book (#653) 2020-07-17 20:15:50 -07:00
firebase.json Add skeleton of eventual zebra book (#653) 2020-07-17 20:15:50 -07:00