-
Notifications
You must be signed in to change notification settings - Fork 575
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
modified poll_oneoff to make it interruptible #1951
Conversation
f416f09
to
54ff77e
Compare
6516265
to
b69d3f2
Compare
0b790e0
to
bf8e2ea
Compare
84b1ba8
to
ce45358
Compare
b86c025
to
101e2f1
Compare
a6d704f
to
477692c
Compare
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.
LGTM
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.
LGTM, left some minor comments.
@wenyongh can we merge |
0546327
to
0b6f812
Compare
Sure, will do that soon. |
size_t *nevents, uint32 *nevents_app) | ||
{ | ||
if (nsubscriptions == 0) | ||
return 0; |
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.
Had better set *nevents_app = 0
before return success.
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.
wouldn't that anyway happen on L1077, given we have now initialised nevents to 0?
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.
Oh, that's really an issue, not sure why the prototype of execute_interruptible_poll_oneoff isn't same as wasmtime_ssp_poll_oneoff. My understanding is that we should define them as same prototype.
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.
it's mostly the same (that's what my intent was too) except for two arguments i.e. module_inst
which needs to be passed to check if there are any exceptions that occurred & nevents_app
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.
Yes, adding module_inst is OK, but how about removing nevents_app? It is duplicated set inside execute_interruptible_poll_oneoff and after calling 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.
right, removed nevents_app
0b6f812
to
2e0a707
Compare
2e0a707
to
5832c54
Compare
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.
LGTM
…1980) Fix issues in the libc-wasi `poll_oneoff` when thread manager is enabled: - The exception of a thread may be cleared when other thread runs into `proc_exit` and then calls `clear_wasi_proc_exit_exception`, so should not use `wasm_runtime_get_exception` to check whether an exception was thrown, use `wasm_cluster_is_thread_terminated` instead - We divided one time poll_oneoff into many times poll_oneoff to check the exception to avoid long time waiting in previous PR, but if all events returned by one time poll are all waiting events, we need to continue to wait but not return directly. Follow-up on #1951. Tested with multiple timeout values, with and without interruption and measured the time spent sleeping.
While we used a different approach for poll_oneoff [1], the implementation works only when the poll list includes an absolute clock event. That is, if we have a thread which is polling on descriptors without a timeout, we fail to terminate the thread. This commit fixes it by applying wasm_runtime_begin_blocking_op to poll as well. [1] bytecodealliance#1951
While we used a different approach for poll_oneoff [1], the implementation works only when the poll list includes an absolute clock event. That is, if we have a thread which is polling on descriptors without a timeout, we fail to terminate the thread. This commit fixes it by applying wasm_runtime_begin_blocking_op to poll as well. [1] bytecodealliance#1951
While we used a different approach for poll_oneoff [1], the implementation works only when the poll list includes an absolute clock event. That is, if we have a thread which is polling on descriptors without a timeout, we fail to terminate the thread. This commit fixes it by applying wasm_runtime_begin_blocking_op to poll as well. [1] bytecodealliance#1951
While we used a different approach for poll_oneoff [1], the implementation works only when the poll list includes an absolute clock event. That is, if we have a thread which is polling on descriptors without a timeout, we fail to terminate the thread. This commit fixes it by applying wasm_runtime_begin_blocking_op to poll as well. [1] bytecodealliance#1951
While we used a different approach for poll_oneoff [1], the implementation works only when the poll list includes an absolute clock event. That is, if we have a thread which is polling on descriptors without a timeout, we fail to terminate the thread. This commit fixes it by applying wasm_runtime_begin_blocking_op to poll as well. [1] #1951
…ytecodealliance#1980) Fix issues in the libc-wasi `poll_oneoff` when thread manager is enabled: - The exception of a thread may be cleared when other thread runs into `proc_exit` and then calls `clear_wasi_proc_exit_exception`, so should not use `wasm_runtime_get_exception` to check whether an exception was thrown, use `wasm_cluster_is_thread_terminated` instead - We divided one time poll_oneoff into many times poll_oneoff to check the exception to avoid long time waiting in previous PR, but if all events returned by one time poll are all waiting events, we need to continue to wait but not return directly. Follow-up on bytecodealliance#1951. Tested with multiple timeout values, with and without interruption and measured the time spent sleeping.
…lliance#3080) While we used a different approach for poll_oneoff [1], the implementation works only when the poll list includes an absolute clock event. That is, if we have a thread which is polling on descriptors without a timeout, we fail to terminate the thread. This commit fixes it by applying wasm_runtime_begin_blocking_op to poll as well. [1] bytecodealliance#1951
No description provided.