-
Notifications
You must be signed in to change notification settings - Fork 303
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
WebSocket Hibernation Manager #449
Conversation
cfb26cf
to
11b4584
Compare
90e82fe
to
ded92ba
Compare
ded92ba
to
f431a85
Compare
// Also note that we box the keys and values such that in the event of a hashmap resizing we don't | ||
// move the underlying data (thereby keeping any references intact). | ||
|
||
std::list<kj::Own<HibernatableWebSocket>> allWs; |
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.
Worth thinking about Harris's comment here capnproto/capnproto#1639 (comment), since HibernatableWebSocket::activeWebSocket
would be in the Accepted
state if it were nonnull and that has a noexcept(false)
dtor.
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.
Just happened to notice this comment, you can probably get away with invoking clear()
on this list in the noexcept(false)
dtor. Keep in mind that you run the risk of throwing from multiple elements of the container, which will probably terminate the program: https://en.cppreference.com/w/cpp/language/throw#Stack_unwinding.
9d80560
to
9b6c104
Compare
adc3da1
to
381b5d1
Compare
src/workerd/api/actor-state.c++
Outdated
// We need to get a HibernationManager to give the websocket to. | ||
auto& a = KJ_REQUIRE_NONNULL(IoContext::current().getActor()); | ||
if (a.getHibernationManager() == nullptr) { | ||
// TODO(now): Actually set the hibernation manager. |
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.
FYI this TODO(now)
is replaced in a later commit once we actually have a HibernationManagerImpl
.
6b1deb1
to
48b0ba4
Compare
1eb4245
to
c06e9bb
Compare
6465e89
to
c142f36
Compare
93d96f2
to
9fd5eb1
Compare
Talked with the team; we're going to serialize the |
5c25f68
to
91070fa
Compare
Rebased on main + bumped connection limit back up because tests are passing with the lower limit. |
c866fab
to
b2e9ee7
Compare
17ad997
to
b696d99
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.
I think this is ready to approve after these last batch of fixes
518becd
to
5c724e2
Compare
Must've lost this include in the rebase somehow? ba1b098 |
0c50dd8
to
f02b98a
Compare
We want to use the existing structure of api::WebSocket for hibernatable websocket's, but the hibernation manager needs to own the kj::WebSocket. Currently, the api::WebSocket owns it, so we need to move a couple things around.
Also modifying the way we pass errors to the hibernation error event because previous assumptions (rpc related) are no longer true.
Previously we introduced the HibernationManager class, but this commit actually implements it. The HibernationManager needs to be stored somewhere that lives long, so we'll put it in the deferred proxy task.
f02b98a
to
40b7de8
Compare
Rebased to get rid of conflicts. |
Old PR: #339
@jqmmes, @xortive