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

SUM(bigint) produces strange results on M1 mac in Docker #99

Closed
bcipriano opened this issue Dec 6, 2022 · 4 comments · Fixed by zonkyio/embedded-postgres-binaries#64
Milestone

Comments

@bcipriano
Copy link

AcademySoftwareFoundation/OpenCue#1199 has a full description of the issue.

Over on the OpenCue project we use embedded-postgres for unit tests.

Basically we are seeing strange results from SUM(bigint) on arm64+Docker where the result is wildly incorrect.

  • Issue does not occur on other architectures.
  • Issue does not occur when running directly on M1 -- only in Docker.
  • I've tried a few different base images (gradle, almalinux) and that doesn't seem to change the result.
  • I've tried a few different Postgres versions -- 11, 12, 14, 15 -- same issue on all of them.
  • I haven't been able to reproduce the issue using the standard postgres Docker image.
  • Changing our queries to SUM(CAST(bigint as numeric)) fixes the issue.

Our build.gradle.

Any ideas here?

@tomix26
Copy link
Collaborator

tomix26 commented Dec 7, 2022

Hi @bcipriano, thanks for the report.

Actually, I'm quite surprised that it works at all. Because there is a similar issue, where the process crashes immediately at the beginning when the database is being initialized, see #95

As I wrote in the linked issue, maybe the problem is caused by using an outdated version of Ubuntu during the build. So you can try to upgrade it - https://github.com/zonkyio/embedded-postgres-binaries/blob/master/build.gradle#L590

You can also try to compare the build scripts between this project and the postgres Docker image. Maybe you will find some major differences that could be causing this.
https://github.com/zonkyio/embedded-postgres-binaries/blob/master/scripts/build-postgres-debian.sh
https://github.com/docker-library/postgres/blob/master/15/bullseye/Dockerfile

@bcipriano
Copy link
Author

Thanks, I'll check these out when I can.

FWIW, the base image I'm using is gradle:6.0.1-jdk13, with basically no modifications.

@bcipriano
Copy link
Author

Made some progress here by playing around with the Ubuntu version used for the build.

  • Tested a local build straight from master, using Ubuntu 14.04, and was able to reproduce the issue.
  • Ubuntu 16.04: same issue.
  • Ubuntu 18.04: this one works fine for me!
  • Ubuntu 20.04: Postgres doesn't start within my image (version 'GLIBC_2.29' not found)
  • Ubuntu 22.04: same, Postgres doesn't start.

I sent zonkyio/embedded-postgres-binaries#64 with my 18.04 changes. My branch list has my changes for the other Ubuntu versions in case that's helpful.

@tomix26
Copy link
Collaborator

tomix26 commented Feb 10, 2023

@bcipriano Thank you very much for your pull request. All tests passed, everything seems to be working fine. New versions of the binaries have been released, so you can try them out. Great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants