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

Integrated code lifecycle: Improve Docker exception handling and fix race conditions #8232

Merged
merged 15 commits into from
Mar 28, 2024

Conversation

laurenzfb
Copy link
Contributor

@laurenzfb laurenzfb commented Mar 20, 2024

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I strictly followed the server coding and design guidelines.
  • I documented the Java code using JavaDoc style.

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).

Motivation and Context

We encountered some issues where exceptions that occured during Docker image pulls where not handled causing the build job to get stuck.

Description

I moved the image pull logic to the build job execution and increased the timeout so there is enough time for the image to be pulled. Exceptions are now handled gracefully.

I also made the build job cancellation more robust and a locking mechanism to the build agent update logic to ensure consistency

Steps for Testing

Prerequisites:

  • 1 Admin
  1. Create a programming exercise with the following Docker image: gitlab.lrz.de:5005/gbs-cm/gbs-tester/gbs:0.0.5
  2. Check the build queue and build agent view. The build jobs for template and solution should not get stuck in the Running Jobs view and should show up in the recent jobs view of the build agents as ERROR

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Summary by CodeRabbit

  • Refactor
    • Removed the queueSizeLimit field for simplification.
    • Enhanced Docker image handling before build job execution.
    • Introduced synchronization and locking mechanisms for improved build job management and cancellation control.
    • Improved exception handling in Docker image pulling process.
    • Added thread safety to build agent information updates.

@github-actions github-actions bot added the server Pull requests that update Java code. (Added Automatically!) label Mar 20, 2024
@github-actions github-actions bot added the config-change Pull requests that change the config in a way that they require a deployment via Ansible. label Mar 20, 2024
@laurenzfb laurenzfb marked this pull request as ready for review March 22, 2024 14:48
@laurenzfb laurenzfb requested a review from a team as a code owner March 22, 2024 14:48
Copy link

coderabbitai bot commented Mar 22, 2024

Walkthrough

The modifications aim to enhance the local continuous integration (CI) system in Artemis by improving build job cancellation behavior. Changes include introducing synchronization mechanisms, enhancing Docker integration for build jobs, and improving exception handling to ensure immediate cancellation and proper thread management.

Changes

File Path Change Summary
.../config/localvcci/LocalCIConfiguration.java Removed queueSizeLimit field; updated log message to exclude queue size limit.
.../service/connectors/localci/buildagent/BuildJobExecutionService.java Added LocalCIDockerService dependency; implemented Docker image pulling before build job execution.
.../service/connectors/localci/buildagent/BuildJobManagementService.java,
.../service/connectors/localci/buildagent/SharedQueueProcessingService.java
Introduced ReentrantLock for synchronization; adjusted timeout values and handling of build job execution including locking mechanisms for cancellation control.
.../service/connectors/localci/buildagent/LocalCIDockerService.java Enhanced exception handling in pullDockerImage method to catch a broader range of exceptions and throw LocalCIException.

Related issues

  • Local CI: Cancel build jobs when exception occurs #7691: The changes in this PR, particularly the introduction of synchronization mechanisms and improved handling of build job execution, directly address the issue's objectives of ensuring immediate cancellation and stopping execution upon encountering exceptions, potentially improving performance by stopping threads as expected.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

rstief
rstief previously approved these changes Mar 22, 2024
Copy link
Contributor

@rstief rstief left a comment

Choose a reason for hiding this comment

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

Code looks good 👍

@krusche krusche added this to the 6.9.5 milestone Mar 24, 2024
mateusmm01
mateusmm01 previously approved these changes Mar 26, 2024
Copy link
Contributor

@mateusmm01 mateusmm01 left a comment

Choose a reason for hiding this comment

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

code lgtm

mateusmm01
mateusmm01 previously approved these changes Mar 26, 2024
Copy link
Contributor

@mateusmm01 mateusmm01 left a comment

Choose a reason for hiding this comment

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

Demonstrated in testing session! Works as expected

milljoniaer
milljoniaer previously approved these changes Mar 27, 2024
Copy link
Contributor

@milljoniaer milljoniaer left a comment

Choose a reason for hiding this comment

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

Demonstrated in testing session, works as expected 👍

rstief
rstief previously approved these changes Mar 27, 2024
Copy link
Contributor

@rstief rstief left a comment

Choose a reason for hiding this comment

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

Reapprove

@laurenzfb laurenzfb dismissed stale reviews from mateusmm01, rstief, and milljoniaer via 8a99c75 March 28, 2024 09:47
@laurenzfb laurenzfb changed the title Integrated code lifecycle: Fix docker image pull exception handling Integrated code lifecycle: Improve Docker exception handling and fix race conditions Mar 28, 2024
mateusmm01
mateusmm01 previously approved these changes Mar 28, 2024
Copy link
Contributor

@mateusmm01 mateusmm01 left a comment

Choose a reason for hiding this comment

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

Code lgtm. Also tested on staging and works as expected. Fixes issue with missing results in build agent view 🚀

@reschandreas
Copy link
Contributor

demonstrated in testing session, works as expected

Copy link
Contributor

@rstief rstief left a comment

Choose a reason for hiding this comment

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

👍

@krusche krusche merged commit edebec9 into develop Mar 28, 2024
24 of 30 checks passed
@krusche krusche deleted the bugfix/fix-docker-image-exception-handling branch March 28, 2024 17:45
krusche pushed a commit that referenced this pull request Mar 28, 2024
beyzaaltuntas pushed a commit that referenced this pull request Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:integrated code lifecycle config-change Pull requests that change the config in a way that they require a deployment via Ansible. ready for review server Pull requests that update Java code. (Added Automatically!)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

6 participants