[ZEPPELIN-6683] Prevent stale notebook WebSocket replies from mutating the active note - #5487
gyowoo1113 wants to merge 15 commits into
Conversation
|
This stays hidden today because each of the three OPs has exactly one listener. But the rejection path returns without logging, so if a second listener is ever added, the only symptom will be "the view does not update" with nothing to trace it back to. As an alternative, I would suggest carrying new Message(OP.INTERPRETER_BINDINGS).put("noteId", noteId).put("interpreterBindings", settingList)if (data.noteId !== noteId) {
return;
}That leaves no client-side state to maintain, so the cleanup question for the pending map and the implicit contract that every caller must go through One thing to settle first: ZEPPELIN-6683 scopes this as preserving a stable request identity, so moving in this direction means adjusting the issue scope. What do you think? |
|
Thanks, that makes sense. I agree that carrying I think So my preference would be to remove the pending-state/consume logic, add Do you think it makes sense to keep that part, or would you prefer to remove the envelope/ |
|
Agreed. Splitting the two things you asked about: The server-side I would keep the envelope support, and give it a consumer in this PR. There is already a workaround it can replace: if (received.op === OP.PARAGRAPH_ADDED && received.data && received.msgId) {
(received.data as MessageReceiveDataTypeMap[OP.PARAGRAPH_ADDED]).msgId = received.msgId;
}Handlers cannot reach the envelope, so
So: drop the server-side |
This reverts commit db48085.
|
Updated based on feedback:
Thanks for the feedback. |
What is this PR for?
This PR prevents stale notebook WebSocket replies from mutating the currently active note.
GET_INTERPRETER_BINDINGS,SAVE_INTERPRETER_BINDINGS,LIST_REVISION_HISTORY, checkpoint creation, andSET_NOTE_REVISIONpreviously returned replies without preserving the originating request identity. The SDKreceive()path also exposed onlymessage.data, so notebook listeners could not determine which note a late reply belonged to.This PR preserves the originating
msgIdon the relevant server reply paths, exposes the full WebSocket envelope through the SDK, and records the note context for pending requests on the client. Notebook handlers now reject replies with missing or unknown request identities, as well as replies whose request note no longer matches the active route.The existing operation names are unchanged, and the change is limited to interpreter-binding and revision-related reply paths.
What type of PR is it?
Bug Fix
Todos
msgIdonINTERPRETER_BINDINGSresponsesmsgIdonLIST_REVISION_HISTORYresponses, including checkpoint repliesmsgIdonSET_NOTE_REVISIONresponsesWhat is the Jira issue?
[ZEPPELIN-6683]
How should this be tested?
Frontend focused tests (from
zeppelin-web-angular):WebSocket contract check:
Server focused test:
./mvnw -pl zeppelin-server -Dtest=NotebookServerTest testAll checks above pass successfully.
Screenshots (if appropriate)
N/A
Questions: