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

Update sockets to use new pipelining support in capnproto. #214

Merged
merged 1 commit into from
Dec 8, 2022

Conversation

harrishancock
Copy link
Collaborator

This is a simplified version of #200, containing just the diff required to be able to merge capnproto/capnproto#1579.

@harrishancock
Copy link
Collaborator Author

harrishancock commented Dec 7, 2022

The diff between #200 and this PR is here: dominik/pipelined-http-connect...harris/pipelined-http-connect

I don't know why that link didn't work...

// the Socket to throw an appropriate error. Right now in this circumstance,
// `request.connection`'s operations will throw KJ exceptions which will be exposed to the
// script as internal errors.
return jsg::alloc<Socket>(kj::mv(request.connection));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised to find that the code doesn't work (stream never receives any data). Looking into this it seems we need to attach the status promise:

Suggested change
return jsg::alloc<Socket>(kj::mv(request.connection));
return jsg::alloc<Socket>(request.connection.attach(kj::mv(request.status)));

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the commit with the above. @jasnell or @kentonv can you confirm that my fix is correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird, attaching this promise shouldn't make any difference, because request.connection already contains its own copy of the promise (two branches of the same split()). That said, this doesn't cause any real harm except extra allocations, so I'm OK with merging in this form if we cannot immediately figure out why it helps. But we need to follow up and figure it out, because it implies a bug somewhere.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm I double checked that I was using the right capnproto commits: my tests definitely fail without the status attached.

@jasnell when you get a chance, please have a look as from chatting with Kenton this seems to be a bug in capnproto/capnproto#1579

@dom96 dom96 force-pushed the harris/pipelined-http-connect branch from 1ce7d4e to 28416eb Compare December 8, 2022 14:02
WORKSPACE Outdated Show resolved Hide resolved
@dom96 dom96 force-pushed the harris/pipelined-http-connect branch from 28416eb to 0a83075 Compare December 8, 2022 18:10
@dom96
Copy link
Collaborator

dom96 commented Dec 8, 2022

Okay, once tests pass I'll be merging this.

dom96 added a commit to dom96/capnproto that referenced this pull request Dec 8, 2022
@dom96 dom96 merged commit 2c6df75 into main Dec 8, 2022
MellowYarker pushed a commit to MellowYarker/capnproto that referenced this pull request Jan 4, 2023
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.

3 participants