pingora icon indicating copy to clipboard operation
pingora copied to clipboard

`pingora-core` fails to compile with the `s2n` TLS provider

Open varunravi98 opened this issue 9 months ago • 3 comments

Describe the bug

pingora-core fails to compile when s2n is enabled for TLS due to a missing match arm in ALPN::to_wire_protocols().

Pingora info

Pingora version: https://github.com/cloudflare/pingora/commit/9ac75d0356f449d26097e08bf49af14de6271727 Rust version: cargo 1.92.0 (344c4567c 2025-10-21) Operating system version: Ubuntu 22.04, though I believe this issue is platform-agnostic

Steps to reproduce

Run cargo build --package pingora-core --features s2n

Expected results

I expected a successful build.

Observed results

The build failed with the following error:

   error[E0004]: non-exhaustive patterns: `&ALPN::Custom(_)` not covered
   --> pingora-core/src/protocols/tls/mod.rs:189:15
    |
189 |         match self {
    |               ^^^^ pattern `&ALPN::Custom(_)` not covered
    |
note: `ALPN` defined here
   --> pingora-core/src/protocols/tls/mod.rs:52:10
    |
 52 | pub enum ALPN {
    |          ^^^^
...
 61 |     Custom(CustomALPN),
    |     ------ not covered
    = note: the matched value is of type `&ALPN`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
192 ~             ALPN::H2H1 => vec![b"h2".to_vec(), b"http/1.1".to_vec()],
193 ~             &ALPN::Custom(_) => todo!(),

Additional context

I believe that the error can be fixed simply by adding a value for ALPN::Custom(custom). In fact, I think simplying copying the match arm provided for ALPN::Custom in Rustls should also work for s2n. I'll link a PR with that fix shortly.

Given that this error renders pingora-core 0.7.0 unusable with s2n, I'd appreciate it if the fix could be released sooner rather than later. Thanks!

varunravi98 avatar Feb 17 '26 08:02 varunravi98

I opened https://github.com/cloudflare/pingora/pull/820 to resolve this, please let me know if you have any questions or concerns!

varunravi98 avatar Feb 17 '26 19:02 varunravi98

This is already fixed on current main: commit 402acae ("Avoid allocating HTTP/2 accept results") introduced the CustomALPN type and the missing ALPN::Custom(_) arm in to_wire_protocols. Verified: cargo check -p pingora-core --features s2n completes with no errors on the latest main. Closing out — no PR needed from this report.

stareezy-1 avatar Aug 06 '26 09:08 stareezy-1

We forgot to close this issue, thank you for your contribution in https://github.com/cloudflare/pingora/pull/820.

andrewhavck avatar Aug 24 '26 17:08 andrewhavck