fix: carry request.cf through debug port capnp layer#6116
Draft
fix: carry request.cf through debug port capnp layer#6116
Conversation
1702953 to
8e0854b
Compare
Add cfBlobJson as a parameter to WorkerdBootstrap::startEvent() in the capnp schema, so request.cf travels as a first-class RPC value through the debug port. Sender (workerd-debug-port-client.c++): - startRequest() passes metadata.cfBlobJson via req.setCfBlobJson() on startEvent Receiver (server.c++): - startEvent() extracts cfBlobJson from RPC params, passes to EventDispatcherImpl - getHttpService() includes cfBlobJson in SubrequestMetadata when creating WorkerInterface - EventDispatcherImpl defers WorkerInterface creation (stores SubrequestChannel)
8e0854b to
3176119
Compare
Merging this PR will degrade performance by 21.01%
Performance Changes
Comparing Footnotes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
request.cfbeing lost when requests go through the debug port (used by Miniflare's native dev registry for cross-worker service bindings)startRequest(metadata)byFetcher::getClientWithTracing()butWorkerdBootstrapSubrequestChannelignored it entirelyChanges
Sender side (
workerd-debug-port-client.c++):CfInjectingWorkerInterface: thinWorkerInterfacewrapper that injectsMF-CF-Blobheader into outgoing HTTP requests whenmetadata.cfBlobJsonis presentWorkerdBootstrapSubrequestChannel::startRequest()now wraps theRpcWorkerInterfacewithCfInjectingWorkerInterfacewhen cf blob is providedReceiver side (
server.c++):CfAwareHttpService: wraps the target service's HTTP interface, extractsMF-CF-Blobheader from incoming requests, and passes cf toSubrequestMetadataEventDispatcherImpldefersWorkerInterfacecreation until the HTTP request arrives (storesSubrequestChannelinstead ofWorkerInterface), enabling cf blob extractionstartEvent()passeskj::addRef(*service)instead ofservice->startRequest({})Context
Part of cloudflare/workers-sdk#12600 — refactoring the Miniflare dev registry to use native debug port RPC instead of a Node.js HTTP proxy.