neondatabase / neon

Neon: Serverless Postgres. We separated storage and compute to offer autoscaling, code-like database branching, and scale to zero.
https://neon.tech
Apache License 2.0
14.28k stars 408 forks source link

Add build with sanitizers to CI #6053

Open bayandin opened 9 months ago

bayandin commented 9 months ago

Let's add a build with sanitizers (asan, ubsan) to the CI pipeline and run tests on it. To not blow up the CI workflow time, let's focus on Postgres 16 first.

Things to keep in mind:

An example can be found in this slack thread.

a-masterov commented 4 months ago

Hi Alexander, Team, First, in the original message, AL described patches for use with Clang, not Gcc. Fortunately, MacOS uses Clang even while we are running binary with the name gcc:

alex@Alexeys-MacBook-Pro neon % /usr/bin/gcc --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin`

On the other hand, the Clang version built in MacOS is 15, but the original message mentioned Clang 18. E.g. Clang v15 issues a warning about '-Wno-cast-function-type-strict' directive. So, I will go on the experiments in docker with the newer version of Clang.

a-masterov commented 4 months ago

So I have figured out the newer version of Clang on MacOSX

brew install llvm

But then I faced another problem

configure:4022: clang -O0 -g3  -fsanitize=address -fsanitize=undefined -fno-sanitize-recover -fno-sanitize=function -Wno-cast-function-type-strict -fsanitize=address -fsanitize=undefined -static-libsan conftest.c  
>&5
clang: error: static AddressSanitizer runtime is not supported on darwin

I tried using docker, but I am getting an error "killed with signal 9", probably due to memory limit, so I am trying virtualization.

a-masterov commented 4 months ago

sanitizer01.txt Here are memory leaks found by ASAN.