Skip to content

Conversation

@bjosv
Copy link
Contributor

@bjosv bjosv commented Jul 27, 2025

Replace deprecated Github runner ubuntu-20.04 with ubuntu-24.04

When running with a newer ubuntu a new issue surfaces with the fork test,
which probably is due to the lift of GLIBC, from v2.31 to v2.34.
Others have this related issue.

An fix for this is to wait for spawned fork-tests to avoid any race conditions.
Each spawned testcase is now exited to avoid running the tests multiple times.

Summary by CodeRabbit

  • Chores

    • Updated CI workflow to use Ubuntu 24.04 and ensured compatibility by installing required OpenSSL packages.
  • Tests

    • Improved process handling and validation in fork-related tests to ensure proper cleanup and verification of child process completion.

bjosv added 2 commits July 27, 2025 21:20
Each spawned testcase is now exited to avoid running the tests multiple times.
This fixes a race condition seen with a newer GNU libc version.

Signed-off-by: Björn Svensson <[email protected]>
@bjosv bjosv requested a review from a team as a code owner July 27, 2025 19:30
@coderabbitai
Copy link

coderabbitai bot commented Jul 27, 2025

Walkthrough

The CI workflow was updated to use Ubuntu 24.04, with explicit installation of OpenSSL 1.1.1f to maintain compatibility. In the test suite, process handling in fork-related tests was improved by adding exit status checks and explicit cleanup, ensuring proper verification of child process behavior.

Changes

Cohort / Files Change Summary
.github/workflows/ci.yml Updated CI to use Ubuntu 24.04; added steps to manually install OpenSSL 1.1.1f before building.
src/lib/test/ForkTests.cpp Enhanced fork tests with exit status handling, explicit cleanup, and parent-child verification.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇
CI hops to newer ground,
Ubuntu’s freshest can be found.
OpenSSL is fetched with care,
While forked tests check what’s fair.
Rabbits cheer for tidy code,
On this well-maintained road!
🌱

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

26-32: Consider adding package integrity verification and error handling.

The OpenSSL 1.1.1f installation approach is sound for maintaining compatibility, but could be improved for robustness and security.

Consider this enhanced version with integrity checks and error handling:

-          # Replace installed OpenSSL with the supported version 1.1.1
-          curl -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb
-          curl -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2.24_amd64.deb
-          curl -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_1.1.1f-1ubuntu2.24_amd64.deb
-          sudo dpkg -i --force-confnew openssl_1.1.1f-1ubuntu2.24_amd64.deb \
-                                       libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb \
-                                       libssl-dev_1.1.1f-1ubuntu2.24_amd64.deb
+          # Replace installed OpenSSL with the supported version 1.1.1
+          set -e
+          curl -fsSL -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb
+          curl -fsSL -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2.24_amd64.deb  
+          curl -fsSL -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_1.1.1f-1ubuntu2.24_amd64.deb
+          # Verify packages exist and are valid
+          dpkg --info openssl_1.1.1f-1ubuntu2.24_amd64.deb > /dev/null
+          dpkg --info libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb > /dev/null
+          dpkg --info libssl-dev_1.1.1f-1ubuntu2.24_amd64.deb > /dev/null
+          sudo dpkg -i --force-confnew openssl_1.1.1f-1ubuntu2.24_amd64.deb \
+                                       libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb \
+                                       libssl-dev_1.1.1f-1ubuntu2.24_amd64.deb

This adds:

  • -fsSL flags to curl for better error handling and security
  • set -e to fail fast on errors
  • dpkg --info checks to verify package validity before installation
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ebf6ff7 and 0d678c7.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml (2 hunks)
  • src/lib/test/ForkTests.cpp (5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Windows (x64, botan)
  • GitHub Check: Windows (x64, openssl)
  • GitHub Check: Windows (x86, openssl)
  • GitHub Check: Linux (openssl)
  • GitHub Check: macOS (botan)
  • GitHub Check: macOS (openssl)
  • GitHub Check: Linux (botan)
🔇 Additional comments (6)
.github/workflows/ci.yml (1)

13-13: LGTM: Ubuntu runner updated correctly.

The migration from ubuntu-20.04 to ubuntu-24.04 is necessary as the former is deprecated. This change aligns with GitHub's recommended practices.

src/lib/test/ForkTests.cpp (5)

43-43: LGTM: Proper header included for process synchronization.

Adding <sys/wait.h> is necessary for the waitpid() functionality used in the improved fork tests.


68-68: LGTM: Status variables added for child process monitoring.

The int status variables are properly declared to capture child process exit information for verification.

Also applies to: 108-108


83-88: Excellent: Proper child process cleanup and deterministic exit.

The improvements address the GLIBC 2.34 fork issues mentioned in the PR objectives:

  • Added explicit C_Finalize(NULL_PTR) to ensure proper resource cleanup in child process
  • Using _exit(EXIT_SUCCESS) prevents the child from running parent cleanup code
  • Clear comment explains the expected behavior

These changes eliminate race conditions and ensure deterministic test behavior.


94-96: Excellent: Robust parent-child synchronization implemented.

The parent process now properly waits for and verifies child completion:

  • waitpid(pid, &status, 0) ensures synchronization and prevents race conditions
  • WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS verifies successful child termination
  • This addresses the Ubuntu 24.04/GLIBC 2.34 compatibility issues mentioned in the PR

This is exactly the type of fix needed for reliable fork testing.


132-142: LGTM: Consistent improvements applied to testResetOnFork.

The same robust child process cleanup and parent synchronization patterns are correctly applied to the testResetOnFork function, ensuring consistency across all fork-related tests.

@bukka
Copy link
Contributor

bukka commented Jul 28, 2025

I have already done this in #783 . Except the OpenSSL 1.1.1 part which I'm not sure is that useful nowadays (no one probably runs it anymore).

@bukka
Copy link
Contributor

bukka commented Jul 28, 2025

Although it might be still good idea to have 1.1.1 in the pipeline. Maybe merging our approaches together would be best. In that case it could be added to Ubuntu 22.04 runner and 24.04 would stay to test OpenSSL 3.0.

@bukka
Copy link
Contributor

bukka commented Jul 28, 2025

I think this is actually better as it's limited so it's better to merge this one and then I can split my changes and extend pipeline...

@jschlyter jschlyter requested review from bukka and kalvdans August 11, 2025 06:58
@jschlyter jschlyter merged commit 76c7ed8 into softhsm:develop Aug 11, 2025
8 checks passed
@bukka
Copy link
Contributor

bukka commented Aug 11, 2025

@jschlyter Thanks for merging this. I created a new PR with updated changes for OpenSSL 3.0 runner in #806 so if you could check that one out, it would be awesome!

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.

4 participants