0chain / gosdk

A client SDK in Go to interface the blockchain and storage platform, and other smart contracts
MIT License
32 stars 29 forks source link

Simultaneous reads from client cause lock #546

Closed sculptex closed 2 years ago

sculptex commented 2 years ago

As per slack discussion (https://0chain.slack.com/archives/C035RK9PTU0/p1660603976306959) with new client read marker lock model, creates lock scenario. This is common scenario in instance of streaming video that downloads partial content in chunks and a random seek performed but also prevents the same client downloading multiple files in parallel.

Example CLI commands to invoke (need to be performed simultaneously):- zbox download --authticket <authticket> --localpath video.mp4.1 --startblock 1 --endblock 4 --blockspermarker 10 zbox download --authticket <authticket> --localpath video.mp4.3 --startblock 9 --endblock 12 --blockspermarker 10

Error section from output:- [ERROR] 2022/08/15 23:46:50.639438 downloadworker.go:114: Download block : https://demo.0chain.net/blobber04 response_error: lock_exists: lock exists for key: 1c4ca4f9b0a14daf01ebf8a5ff1775271d61d6ea48d404afdde2e0fa5439da78:e72e1d6896eda1a700269a23156c9765ca464a02e58fe55b153ebbddeac60ef6

Currently, the lock persists and no further downloading can be performed from that allocation by that client.

lpoli commented 2 years ago

This issue is fixed by https://github.com/0chain/gosdk/pull/551