Skip to content

[ZEPPELIN-6551] Fix Job Manager crash on removal broadcast for a note not in the viewer's list#5337

Open
kimyenac wants to merge 1 commit into
apache:masterfrom
kimyenac:ZEPPELIN-6551
Open

[ZEPPELIN-6551] Fix Job Manager crash on removal broadcast for a note not in the viewer's list#5337
kimyenac wants to merge 1 commit into
apache:masterfrom
kimyenac:ZEPPELIN-6551

Conversation

@kimyenac

Copy link
Copy Markdown
Contributor

What is this PR for?

When a note is permanently deleted, the backend broadcasts a field-less NoteJobInfo stub (noteName=null, isRemoved=true) to every Job Manager subscriber, while each viewer's initial job list is owner-filtered (JobManagerService#getNoteJobInfoByUnixTime).

For a note the viewer does not own, updateJobs fell into the currentJobIndex === -1 branch and pushed the stub into this.jobs. filterJobs then ran job.noteName.match(noteNameReg) and threw TypeError: Cannot read properties of undefined (reading 'match'). Because the stub persists in this.jobs, every subsequent filterJobs (each filter keystroke / job update) rethrew, so the page's filter/sort stayed broken until re-navigation.

This affects any user viewing /jobmanager when another user permanently deletes a note they don't own.

What does this PR do?

  • updateJobs: do not add removal stubs that aren't already in the list (if (!updateJob.isRemoved)). The guard is kept nested inside if (currentJobIndex === -1) rather than merged into that condition, so a removal stub can never fall through to the else branch's splice(currentJobIndex, 1) — merging would call splice(-1, 1) and silently drop the last job.
  • filterJobs: guard job.noteName?.match(...) with optional chaining as defense in depth.

What type of PR is it?

Bug Fix

What is the Jira issue?

How should this be tested?

  • cd zeppelin-web-angular && npm run lint
  • With two users: open /jobmanager as user A; as user B permanently delete a note A does not own; confirm A's page keeps filtering without a console TypeError.

Questions:

  • Does the license files need to update? No
  • Is there breaking changes for older versions? No
  • Does this needs documentation? No

… not in the viewer's list

A permanent note deletion broadcasts a field-less NoteJobInfo stub
(noteName=null, isRemoved=true) to every Job Manager subscriber, while
each viewer's job list is owner-filtered. For a note the viewer doesn't
own, updateJobs pushed the stub (currentJobIndex === -1), then filterJobs
threw "Cannot read properties of undefined (reading 'match')" on
job.noteName and kept rethrowing, breaking filter/sort until re-navigation.

- updateJobs: don't add removal stubs that aren't already in the list.
  Guard is nested (not merged into the currentJobIndex === -1 condition)
  so a removal stub can't fall through to the splice(-1) branch.
- filterJobs: guard job.noteName with optional chaining as defense in depth.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jongyoul

Copy link
Copy Markdown
Member

@kimyenac Can we add test cases for this issue? :-)

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.

2 participants