Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Data racing may happen in the current redis related implmentation #556

Open
howjmay opened this issue Apr 10, 2020 · 5 comments
Open

Data racing may happen in the current redis related implmentation #556

howjmay opened this issue Apr 10, 2020 · 5 comments
Assignees
Labels
C-bug Category - Something isn't working C-investigation Category - Investigation P-medium Priority - Medium, not hurry but needed

Comments

@howjmay
Copy link
Contributor

howjmay commented Apr 10, 2020

The current redis implementation may cause data racing. We should investigate whether will data racing occur.

@howjmay howjmay added C-bug Category - Something isn't working C-investigation Category - Investigation P-medium Priority - Medium, not hurry but needed labels Apr 13, 2020
@howjmay
Copy link
Contributor Author

howjmay commented May 6, 2020

There are three kinds of redis list are used in current tangle-accelerator. Data racing may happen during operation among these lists
These lists are

  1. buffer list: Buffer the unsent failed transactions
  2. done list: Buffer the sent failed transactions
  3. bundle list: Store the bundle objects. Each element in this list is a transaction object

@howjmay
Copy link
Contributor Author

howjmay commented May 6, 2020

buffer list

New UUID would be pushed to buffer list when ta_send_trytes() failed.
The elements in buffer list would be popped in broadcast_buffered_txn() when a bundle is successfully broadcasted.

@howjmay
Copy link
Contributor Author

howjmay commented May 6, 2020

done list

Successefully broadcasted UUID will be pushed in broadcast_buffered_txn()
UUID will be popped in ta_fetch_txn_with_uuid(), when a client successfully fetch the information.

@howjmay
Copy link
Contributor Author

howjmay commented May 6, 2020

bundle list

Bundle list will be created in the following 2 situation:

  1. Push failed bundle into the list before pusing the UUID to the list in push_txn_to_buffer()
  2. Push broadcasted bundle to sent bundle list in broadcast_buffered_txn(). (TODO: we should delete the UUID from the unsent transction list first, then delete the outdated bundle list)

Bundle list will be deleted at two place:

  1. Buffered bundle has been successfully broadcasted, so we need to fill the bundle list with new value (trunk, branch, etc)
  2. A client has fetched this buffered bundle in sent buffer list.

@howjmay
Copy link
Contributor Author

howjmay commented May 11, 2020

Data racing may happen in

  1. A bundle is transfered from buffer list to done list
    Between cache_list_pop() and cache_list_push() (around here https://github.com/DLTcollab/tangle-accelerator/blob/develop/accelerator/core/core.c#L741), a request may not able to find the corresponding UUID.
  2. A bundle is cleared from the done list, since TA reaches the maximum capacity.
    A request want to fetch bundle object, but health_track thread interupt and clear this bundle.

CC @marktwtn

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C-bug Category - Something isn't working C-investigation Category - Investigation P-medium Priority - Medium, not hurry but needed
Projects
None yet
Development

No branches or pull requests

2 participants