Skip to content
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

[3.2] Get future before use to avoid race on set_value get_future #482

Merged
merged 2 commits into from
Jun 21, 2022

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Jun 21, 2022

Backport EOSIO/eos#9331. GH issue #460.

In the original code, get_future and set_value run on different threads and can cause a race condition when modifying/accessing the promise object at the same time. Change to call get_future at the beginning.

@spoonincode
Copy link
Member

okay to skip in 3.1 backport imo -- only clutched in when neither Linux nor Mac

@heifner
Copy link
Member

heifner commented Jun 21, 2022

okay to skip in 3.1 backport imo -- only clutched in when neither Linux nor Mac

I agree. These never exhibited a problem, they were fixed when similar code did exhibit an issue.

@linh2931 linh2931 merged commit a4ffdf5 into main Jun 21, 2022
@linh2931 linh2931 deleted the fix_promise_use branch June 21, 2022 18:42
@linh2931 linh2931 linked an issue Jun 23, 2022 that may be closed by this pull request
@arhag arhag changed the title Get future before use to avoid race on set_value get_future [3.2] Get future before use to avoid race on set_value get_future Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backport: fix promise use in platform_timer_asio_fallback.cpp
3 participants