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

build: link storage controller with system libpq #10258

Closed
wants to merge 1 commit into from

Conversation

jcsp
Copy link
Collaborator

@jcsp jcsp commented Jan 2, 2025

Problem

We see occasional storage controller segfaults (https://github.com/neondatabase/cloud/issues/21010), which are correlated with database connection errors, and it is known that using statically linked openssl from multi-threaded programs is risky (https://github.com/neondatabase/cloud/issues/16155)

Summary of changes

  • Include the system postgres 15 package in container image
  • Don't set CARGO_CMD_PREFIX to link with our custom postgres build when building.

Important: helm charts set LD_LIBRARY_PATH to point to a v16 path -- because we'll be building binaries against v15 (because that's what's available on debian bookworm), that might not work seamlessly, we might need to coordinate a helm chart change deploy with this change.

Why is it okay to only use statically-linked openssl for our other binaries and not for the storage controller? Because the purpose of that static linking is to make our postgres builds agnostic wrt the specific openssl version on the distro where we run. The controller doesn't need that, because it can use a totally vanilla upstream postgres for its client library, and that vanilla system postgres package will already use whichever openssl is available on the distro where we're running.

@jcsp jcsp added t/bug Issue Type: Bug c/storage/controller Component: Storage Controller labels Jan 2, 2025
@jcsp jcsp force-pushed the jcsp/controller-system-libpq branch from 6a802d5 to e0b329a Compare January 2, 2025 12:48
Copy link

github-actions bot commented Jan 2, 2025

7095 tests run: 6797 passed, 0 failed, 298 skipped (full report)


Flaky tests (2)

Postgres 15

Postgres 14

  • test_physical_replication_config_mismatch_too_many_known_xids: release-arm64

Code coverage* (full report)

  • functions: 31.2% (8399 of 26881 functions)
  • lines: 48.0% (66686 of 139074 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
e09b33b at 2025-01-02T15:40:36.244Z :recycle:

@jcsp jcsp force-pushed the jcsp/controller-system-libpq branch from e0b329a to e09b33b Compare January 2, 2025 14:23
@arpad-m
Copy link
Member

arpad-m commented Jan 3, 2025

Related: #10108

Same comment as in #10108 applies, we use v16 instances in prod. However, here we need to use the debian package. But version 16 is not available in the default Debian 12 repos :/.

I suppose it's okay to use the v15 client with v16 instances?

jcsp added a commit that referenced this pull request Jan 3, 2025
This is for use by the storage controller, which links
dynamically with `libpq`.  We currently use the neon-built
libpq, but this may be unsafe for use from multi-threaded programs
like the controller, as it uses a statically linked openssl

Precursor to #10258
github-merge-queue bot pushed a commit that referenced this pull request Jan 3, 2025
## Problem

We are chasing down segfaults in the storage controller
neondatabase/cloud#21010

This is for use by the storage controller, which links dynamically with
`libpq`. We currently use the neon-built libpq, but this may be unsafe
for use from multi-threaded programs like the controller, as it uses a
statically linked openssl

Precursor to #10258

## Summary of changes

- Include `postgresql-15` in container builds.

The reason for using version 15 is simply because that is what's
available in Debian 12 without adding any extra repositories, and we
don't have any special need for latest version in our libpq usage.
@jcsp jcsp closed this Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/storage/controller Component: Storage Controller t/bug Issue Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants