-
Notifications
You must be signed in to change notification settings - Fork 71
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
[4.0] Added missing calls to wasmifs on read-only threads #964
Conversation
…ducer_plugin startup
… read-only threads
@@ -46,6 +46,6 @@ namespace eosio { namespace chain { namespace webassembly { | |||
} | |||
|
|||
void interface::eosio_exit( int32_t code ) const { | |||
context.control.get_wasm_interface().exit(); | |||
context.control.wasm_interface_exit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm understanding right, I don't think this is the correct behavior. When a contract calls eosio_exit
it's a "clean" exit of the executing contract. But this now calls
leap/libraries/chain/controller.cpp
Lines 2741 to 2747 in 1f46ff6
void wasm_interface_exit() { | |
// exit all running wasmifs | |
wasmif.exit(); | |
for (auto& ele: threaded_wasmifs) { | |
ele.second->exit(); | |
} | |
} |
which looks like it operates on all executing contracts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Matt. You are correct. I was wrong to exit other executing contracts. Am reverting it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am looking into #956 after this PR.
This
Here is how I fixed it:
There is tabs in that file, so the indentation looks weird in the diff. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix use of static map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved assuming that the static map
will be fixed in a diff PR.
I am doing a separate PR for #969 shortly. |
The PR is #975 |
Verified that #975 fixes this issue. |
Thanks @heifner and @spoonincode! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
wasm_interface wasmif; // used by main thread and all threads for EOSVMOC | ||
thread_local static std::unique_ptr<wasm_interface> wasmif_thread_local; // a copy for each read-only thread, used by eos-vm and eos-vm-jit | ||
std::mutex threaded_wasmifs_mtx; | ||
std::unordered_map<std::thread::id, std::unique_ptr<wasm_interface>> threaded_wasmifs; // one for each read-only thread, used by eos-vm and eos-vm-jit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure you need a unique_ptr
here.. couldn't you just emplace()
the wasm_interface
in?
Resolve #963