Skip to content

fix(native): Prevent timezone lookup failures in Ubuntu runtime - #28407

Open
1fanwang wants to merge 1 commit into
prestodb:masterfrom
1fanwang:fix/prestissimo-runtime-tzdata
Open

1fanwang wants to merge 1 commit into
prestodb:masterfrom
1fanwang:fix/prestissimo-runtime-tzdata

Conversation

@1fanwang

@1fanwang 1fanwang commented Aug 29, 2026

Copy link
Copy Markdown

On Ubuntu-based Prestissimo workers, even SELECT 1 = 1 fails with discover_tz_dir failed to find zoneinfo. The runtime image has no timezone database for Velox to load.

The runtime stage now installs tzdata when its base provides apt-get. The default CentOS Stream 9 path is unchanged because it already contains /usr/share/zoneinfo.

Closes #25531.

The same packaging gap was fixed downstream in y-scope#26 and later restored in y-scope#154.

Testing

The probe compiles __libcpp_tzdb_directory() from Velox commit b7be48aaa3a1300cbc2099d42d244ec42511297d, the submodule pinned by Presto master. The timezone lookup reached by the failing basic query errors in the current Ubuntu runtime and returns /usr/share/zoneinfo with this change.

Self-contained probe and raw logs
$ curl -fsSL \
    https://raw.githubusercontent.com/facebookincubator/velox/b7be48aaa3a1300cbc2099d42d244ec42511297d/velox/external/tzdb/tzdb.cpp \
    -o tzdb.cpp
$ {
    cat <<'CPP'
#include <sys/stat.h>
#include <unistd.h>
#include <cstdlib>
#include <iostream>
#include <stdexcept>
#include <string>
#define CONSTDATA constexpr
namespace facebook::velox::tzdb {
CPP
    sed -n '/std::string __libcpp_tzdb_directory()/,/^}/p' tzdb.cpp
    cat <<'CPP'
}
int main() {
  try {
    std::cout << facebook::velox::tzdb::__libcpp_tzdb_directory() << '\n';
    return 0;
  } catch (const std::exception& error) {
    std::cerr << error.what();
    return 1;
  }
}
CPP
  } > probe.cpp

Both images compile that probe in an Ubuntu build stage and copy it into a bare ubuntu:22.04 runtime stage. The second image includes the exact RUN block from this PR.

# Dockerfile.before
FROM ubuntu:22.04 AS build
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y g++
COPY probe.cpp /
RUN g++ -std=c++20 /probe.cpp -o /tzdb-probe
FROM ubuntu:22.04
COPY --from=build /tzdb-probe /
ENTRYPOINT ["/tzdb-probe"]
# Dockerfile.after
FROM ubuntu:22.04 AS build
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y g++
COPY probe.cpp /
RUN g++ -std=c++20 /probe.cpp -o /tzdb-probe
FROM ubuntu:22.04
RUN if command -v apt-get > /dev/null 2>&1; then \
        apt-get update \
        && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
            tzdata \
        && rm -rf /var/lib/apt/lists/*; \
    fi
COPY --from=build /tzdb-probe /
ENTRYPOINT ["/tzdb-probe"]
# Dockerfile.centos
FROM quay.io/centos/centos:stream9
RUN if command -v apt-get > /dev/null 2>&1; then \
        apt-get update \
        && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
            tzdata \
        && rm -rf /var/lib/apt/lists/*; \
    fi
RUN test ! -e /usr/bin/apt-get && test -d /usr/share/zoneinfo
$ docker build -q -f Dockerfile.before -t presto-25531-before .
$ docker run --rm presto-25531-before
discover_tz_dir failed to find zoneinfo
$ echo $?
1

$ docker build -q -f Dockerfile.after -t presto-25531-after .
$ docker run --rm presto-25531-after
/usr/share/zoneinfo
$ echo $?
0

$ docker build -q -f Dockerfile.centos -t presto-25531-centos-check .
$ docker run --rm presto-25531-centos-check /bin/sh -c \
    'printf "apt-get="; command -v apt-get || printf "absent\n"; test -d /usr/share/zoneinfo; printf "zoneinfo=/usr/share/zoneinfo\n"'
apt-get=absent
zoneinfo=/usr/share/zoneinfo
== RELEASE NOTES ==

Prestissimo (Native Execution) Changes
* Fix Ubuntu-based worker images failing queries because timezone data is unavailable.

Signed-off-by: Stefan Wang <1fannnw@gmail.com>
@1fanwang
1fanwang requested review from a team as code owners August 29, 2026 12:07
@sourcery-ai

sourcery-ai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The runtime Dockerfile now conditionally installs tzdata for apt-based base images, ensuring Velox can resolve /usr/share/zoneinfo in Ubuntu runtimes while preserving the existing CentOS path and cleaning package metadata.

Flow diagram for conditional runtime timezone provisioning

flowchart TD
    A[Runtime base image] --> B{command -v apt-get}
    B -->|available| C[apt-get update]
    C --> D[apt-get install tzdata]
    D --> E[rm -rf /var/lib/apt/lists/*]
    E --> F[Velox resolves /usr/share/zoneinfo]
    B -->|absent| G[Use existing zoneinfo database]
    G --> F
Loading

File-Level Changes

Change Details Files
Install the timezone database conditionally in runtime images that use apt-based package management.
  • Detect whether apt-get is available before installing packages.
  • Install tzdata non-interactively with minimal recommended dependencies.
  • Remove apt package lists after installation to reduce runtime image residue.
  • Leave CentOS Stream 9 behavior unchanged because its existing zoneinfo database remains available.
presto-native-execution/scripts/dockerfiles/prestissimo-runtime.dockerfile

Assessment against linked issues

Issue Objective Addressed Explanation
#25531 Ensure the Prestissimo runtime image includes a timezone database so Velox can locate zoneinfo and execute queries without discover_tz_dir failed to find zoneinfo.
#25531 Apply the timezone dependency fix to Ubuntu-based runtime images without breaking the existing CentOS runtime path.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@1fanwang 1fanwang closed this Aug 29, 2026
@1fanwang 1fanwang reopened this Aug 29, 2026
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.

[Native] Missing system timezone dependency in prestissmo runtime image.

1 participant