Skip to content

vine: delete the replaced recovery task of a temp file - #4516

Open
JinZhou5042 wants to merge 2 commits into
cooperative-computing-lab:masterfrom
JinZhou5042:vine-replace-recovery-task
Open

JinZhou5042 wants to merge 2 commits into
cooperative-computing-lab:masterfrom
JinZhou5042:vine-replace-recovery-task

Conversation

@JinZhou5042

Copy link
Copy Markdown
Member

Proposed Changes

For #4515

Merge Checklist

The following items must be completed before PRs can be merged.
Check these off to verify you have completed all steps.

  • make test Run local tests prior to pushing.
  • make format Format source code to comply with lint policies. Note that some lint errors can only be resolved manually (e.g., Python)
  • make lint Run lint on source code prior to pushing.
  • Manual Update: Update the manual to reflect user-visible changes.
  • Type Labels: Select a github label for the type: bugfix, enhancement, etc.
  • Product Labels: Select a github label for the product: TaskVine, Makeflow, etc.
  • PR RTM: Mark your PR as ready to merge.

@JinZhou5042 JinZhou5042 self-assigned this Oct 13, 2026
@JinZhou5042 JinZhou5042 added the bug For modifications that fix a flaw in the code. label Oct 13, 2026

@btovar btovar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are we sure that the pointer of previous is not being used anywhere else? Would it be better to skip the creation of the new recovery task and simply use previous?

@JinZhou5042
JinZhou5042 force-pushed the vine-replace-recovery-task branch from d14b629 to 03b6674 Compare October 14, 2026 20:37
@JinZhou5042

Copy link
Copy Markdown
Member Author

Yes, it is safe because vine_task_delete() only drops the reference this file held, the previous task only gets freed if nothing else holds it.

Even if we could reuse the previous one conceptually, vine_submit() still lets a later task claim the same file and sets the recovery task at submission, so we should always track the newest one.

And the root cause is that this line takes a reference to the new recovery task but never gives back the one it held on the old task, so it leaks every time the file already has a recovery task

@btovar

btovar commented Oct 15, 2026

Copy link
Copy Markdown
Member

That's my worry. Not that we will have segfault, but that some other part of the system still refers to the old task. What happens when two tasks refer to the same temp file?

@JinZhou5042

Copy link
Copy Markdown
Member Author

Every holder of the old recovery task has its own reference and replacing it only drops the file's reference, so it is safe?

@btovar

btovar commented Oct 15, 2026

Copy link
Copy Markdown
Member

So either the old pointer is held somewhere else and it is still valid and we should not create a new recovery tasks, or it is not, which means we have the potential to a hidden bug? I'm not talking about memory issues, but whether the system behaves as it should.

@JinZhou5042

Copy link
Copy Markdown
Member Author

But this pr doesn't change the system's behavior? Since we already point the file at the newest task's copy, and this only releases the reference to the old copy that the assignment used to leak

@JinZhou5042

Copy link
Copy Markdown
Member Author

the file added a reference to the old recovery task previously, so that reference has to be dropped anyway

@btovar

btovar commented Oct 15, 2026

Copy link
Copy Markdown
Member

From the other issue that you mention, what happens when the recovery task generates two files but only one is lost?
I am not arguing whether there is a leak, there is, but rather that either the old task can be used or we have a more difficult issue. I just want to know if that's the case.

@JinZhou5042

Copy link
Copy Markdown
Member Author

If a task creates two files and only one is lost, the recovery task reruns the whole task and recreates both files. The only side effect is that we have one extra copy of the good file, and the reference count here is correct since both files point to the same recovery task

If the same task is submitted twice by the user, all of its files would now point to the newest task and drop the old one. Other parties in the system can still use the old task if they previously added a reference to it.

The only problematic scenario is when multiple tasks create the same file, which causes chaos. But that is a separate problem, since allowing multiple tasks to create the same file probably shouldn't be allowed in the first place?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug For modifications that fix a flaw in the code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants