-
Notifications
You must be signed in to change notification settings - Fork 218
Port polling operations to wasip2 #608
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
Port polling operations to wasip2 #608
Conversation
a6b6187
to
e1f5732
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.
in poll_wasip2()
I think that every pollable not on the ready list gets leaked. In general I think its possible to hold onto and reuse pollables for streams (and, in prior prs, streams for files/sockets) longer than this implementation does at the moment. We can leave pollable reuse for a future PR but we should fix the leaks in this one, if possible.
__wasi_event_t ev; | ||
__wasi_errno_t error = __wasi_poll_oneoff(&sub, &ev, 1, &nevents); | ||
return error == 0 && ev.error == 0 ? 0 : ENOTSUP; | ||
poll_method_pollable_block(poll_borrow_pollable(pollable)); |
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.
The pollable gets leaked here - need to drop 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.
Fixed in ca323cc
} | ||
} else { | ||
} else if (state->entry->tag == DESCRIPTOR_TABLE_ENTRY_FILE_STREAM) { | ||
poll_pollable_drop_own(state->pollable); |
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.
This file originally used only tabs, and some of your changes introduce spaces. I don't care one way or the other but its helpful if its consistent in the file
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.
Replaced tabs with spaces in 40b71f6
5e0771a
to
c42c2b9
Compare
c42c2b9 should fix that. |
ca323cc
to
ccdfff3
Compare
At this point, there should be no further uses of the preview1 component adapter for polling methods (__wasi_poll_oneoff()) when __wasilibc_use_wasip2 is defined.
ccdfff3
to
7b186b5
Compare
Rebased, ready for (further) review now! |
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. The biggest thing is that we need better testing of pollables, but its difficult to impossible to do that from inside a single program, especially without sockets. But thats a big problem I don't want to gate this on, so lets get this landed and chat about how to approach that as follow-on work.
Port poll() to use wasip2 poll method in all cases
At this point, there should be no further uses of the preview1
component adapter for polling methods (__wasi_poll_oneoff())
when __wasilibc_use_wasip2 is defined.