Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

depends_on ignored if server is restarted #1606

Closed
5 tasks done
alexef opened this issue Mar 8, 2023 · 6 comments
Closed
5 tasks done

depends_on ignored if server is restarted #1606

alexef opened this issue Mar 8, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@alexef
Copy link
Contributor

alexef commented Mar 8, 2023

Component

server

Describe the bug

assume a multi pipeline set up, with:

  • pipeline a
  • pipeline b, depends_on: [pipeline a]

while a is running and b is pending, restart the drone server

what is expected: b stays in pending until a completes
what happens: b immediately starts running, ignoring a which is also still running

System Info

{
  "source": "https://github.com/woodpecker-ci/woodpecker",
  "version": "v0.14.2"
}

I know this is an older version, I will now try to reproduce the issue on the latest release.

Additional context

maybe related to: #200

Validations

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Checked that the bug isn't fixed in the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
  • Check that this is a concrete bug. For Q&A join our Discord Chat Server or the Matrix room.
@alexef alexef added the bug Something isn't working label Mar 8, 2023
@alexef
Copy link
Contributor Author

alexef commented Mar 8, 2023

Update: we (cc: @lukaszgyg) were able to reproduce the issue (same steps) also on latest stable:

{
  "source": "https://github.com/woodpecker-ci/woodpecker",
  "version": "0.15.6"
}

@alexef
Copy link
Contributor Author

alexef commented Mar 8, 2023

By checking the code (it's been a while since I touched it), it seems like we have two representation of a Task, with a slight difference:

  • queue.Task (in memory, has Dependencies and DepStatus)
  • model.Task (in datastore, has only Dependencies)

the task.ShouldRun method will check DepStatus. However, when we load tasks in memory (at start up) we don't fill the DepStatus property. When this is empty, the ShouldRun returns true.

LATER EDIT: the only place where we seem to write DepStatus is in the finished implementation. I believe this logic should also be added to persistent.go when we load a cold server.

@anbraten does this make sense?

@anbraten
Copy link
Member

anbraten commented Mar 8, 2023

@alexef Good catch. Yes it definitely seems to be missing DepStatus.

@6543 6543 changed the title depends_on ignored if drone server is restarted depends_on ignored if server is restarted Mar 8, 2023
@6543
Copy link
Member

6543 commented Mar 8, 2023

I'm not happy how queue is implemented atm at all ...: #1518 , ...

I think that could be done in one catch :)

@alexef
Copy link
Contributor Author

alexef commented Mar 9, 2023

Agree a rewrite is granted, but I would like to see this bug fixed (as it negatively impacts our organisation). Will prepare a pr :)

@alexef
Copy link
Contributor Author

alexef commented Mar 14, 2023

changes are in master.

now trying to also backport to v0.15 #1625

@alexef alexef closed this as completed Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants