Repository navigation
Report HTTP server responses to the dependency graph - #247
Merged
Merged
Conversation
An http.ServerResponse reports a responseStart{status} node at its head
(writeHead, also implicit), a responseData{length} node per body write
of at least one byte, and a responseEnd node at end(). Data and end have
a creator edge from the start. All are made in the JS that writes, so
each one's execution is its cause. Kinds as workerd reports them
(backend#13944).
JS assigns a response its id at the head, only while instrumented; the
C++ graph keeps each started response's start node until its end.
REPLAY_BACKEND_REV: backend master with nodejs#13944.
Data and end are caused by the JS that writes them (executionPoint). A creator edge from the head would be their primary cause within 50 ms of it. Without it, the bindings are stateless and responses carry no id. The sites call gated wrappers in internal/async_hooks.
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
asyncInit{WRITEWRAP}nodes, shared with every socket write.http.ServerResponsenow reports the response vertices workerd reports for a fetch handler's response.responseStart{status},responseData{length},responseEnd.Model
executionPoint→ that execution.scheduleredge from the JS settlement. node does not.creatoredge fromresponseStartwould outrankexecutionPointwithin 50 ms of the head (backendgetPrimaryCause,ignorePredecessorEdge).writeHead(200); rows = await query(); end(body).responseEndmust lead to the query, not to the head.Sites
responseStart{status}ServerResponse#writeHead, after the head is stored. Covers the implicit head ofwrite/end/flushHeaders.responseData{length}OutgoingMessagewrite_of aServerResponse, after the send, for ≥ 1 byte. Coverswrite(chunk)andend(chunk).responseEndOutgoingMessage#endof aServerResponse, once it is finished.length: the chunk's bytes, as the message counts them.internal/async_hooks.ServerResponsevsClientRequest, which sharesOutgoingMessage:instanceof, checked only while instrumented.writeInformation): not the response's head.Http2Streamwrites run throughWritablebuffering, so they need their own sites.Prod behavior
end().instanceof.Buffer.byteLengthruns only for string chunks whose length was not computed yet.Data
linux-node-20261117-840941fc92c8-9b4881ad1084-dev(BK Merge pull request #1 from iojs/v1.x nodejs/node#619), mainlinux-node-20261117-53a4b1e02991-5d351da35be9(BK src: rework early debug signal handling nodejs/node#615).head+end ×1e5: 1e5ServerResponses without a socket, eachwriteHead(200)+end().write str ×1e5,write buf ×1e5: 1e5 5-byte writes to one response without a socket.http ×2e3: 2e3 keep-alive requests to an in-process server, each response 10 writes +end().RECORD_REPLAY_DISABLE_FEATURES=["dependency-graph"]RECORD_REPLAY_DONT_RECORD=1), mainREPLAY_BACKEND_REV