Skip to content

Apache DataFusion SQL Query Engine

ARROW-7119: [C++][CI] Show automatic backtraces

Krisztián Szűcs0ff20169fbbe
diff --git a/.env b/.env
index 7deac551dc..46c57db29f 100644
--- a/.env
+++ b/.env
@@ -18,6 +18,7 @@
# All of the following environment variables are required to set default values
# for the parameters in docker-compose.yml.
+ULIMIT_CORE=-1
REPO=apache/arrow-dev
ARCH=amd64
CUDA=9.1
diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml
index 2aacd50839..c6c4510851 100644
--- a/.github/workflows/cpp.yml
+++ b/.github/workflows/cpp.yml
@@ -50,7 +50,10 @@ jobs:
run: docker-compose build conda-cpp
- name: Docker Run
shell: bash
- run: docker-compose run conda-cpp
+ run: |
+ sudo sysctl -w kernel.core_pattern="core.%e.%p"
+ ulimit -c unlimited
+ docker-compose run conda-cpp
- name: Docker Push
if: success() && github.event_name == 'push' && github.repository == 'apache/arrow'
continue-on-error: true
@@ -137,7 +140,11 @@ jobs:
run: ci/scripts/cpp_build.sh $(pwd) $(pwd)/build
- name: Test
shell: bash
- run: ci/scripts/cpp_test.sh $(pwd) $(pwd)/build
+ run: |
+ sudo sysctl -w kern.coredump=1
+ sudo sysctl -w kern.corefile=core.%N.%P
+ ulimit -c unlimited # must enable within the same shell
+ ci/scripts/cpp_test.sh $(pwd) $(pwd)/build
windows:
name: AMD64 ${{ matrix.name }} C++
diff --git a/.github/workflows/cpp_cron.yml b/.github/workflows/cpp_cron.yml
index ee32e19cf5..e47f1a7f74 100644
--- a/.github/workflows/cpp_cron.yml
+++ b/.github/workflows/cpp_cron.yml
@@ -56,7 +56,10 @@ jobs:
run: docker-compose build debian-cpp
- name: Docker Run
shell: bash
- run: docker-compose run debian-cpp
+ run: |
+ sudo sysctl -w kernel.core_pattern="core.%e.%p"
+ ulimit -c unlimited
+ docker-compose run debian-cpp
- name: Docker Push
if: success() && github.repository == 'apache/arrow'
continue-on-error: true
@@ -88,7 +91,10 @@ jobs:
run: docker-compose build fedora-cpp
- name: Docker Run
shell: bash
- run: docker-compose run fedora-cpp
+ run: |
+ sudo sysctl -w kernel.core_pattern="core.%e.%p"
+ ulimit -c unlimited
+ docker-compose run fedora-cpp
- name: Docker Push
if: success() && github.repository == 'apache/arrow'
continue-on-error: true
@@ -120,7 +126,10 @@ jobs:
run: docker-compose build ubuntu-cpp
- name: Docker Run
shell: bash
- run: docker-compose run ubuntu-cpp
+ run: |
+ sudo sysctl -w kernel.core_pattern="core.%e.%p"
+ ulimit -c unlimited
+ docker-compose run ubuntu-cpp
# No push step, it's the same image as ubuntu-cpp-sanitizer
ubuntu-cmake32:
@@ -150,7 +159,10 @@ jobs:
docker-compose build ubuntu-cpp-cmake32
- name: Docker Run
shell: bash
- run: docker-compose run ubuntu-cpp-cmake32
+ run: |
+ sudo sysctl -w kernel.core_pattern="core.%e.%p"
+ ulimit -c unlimited
+ docker-compose run ubuntu-cpp-cmake32
- name: Docker Push
if: success() && github.repository == 'apache/arrow'
continue-on-error: true
diff --git a/ci/docker/conda-cpp.dockerfile b/ci/docker/conda-cpp.dockerfile
index e806785c86..0e35b6caf6 100644
--- a/ci/docker/conda-cpp.dockerfile
+++ b/ci/docker/conda-cpp.dockerfile
@@ -46,7 +46,10 @@ RUN conda create -n arrow -q \
--file arrow/ci/conda_env_unix.yml \
--file arrow/ci/conda_env_cpp.yml \
--file arrow/ci/conda_env_gandiva.yml \
- git compilers valgrind && \
+ compilers \
+ gdb \
+ git \
+ valgrind && \
conda clean --all
# activate the created environment by default
diff --git a/ci/docker/cuda-9.1-cpp.dockerfile b/ci/docker/cuda-9.1-cpp.dockerfile
index bf62ffa9a5..86e4d5c162 100644
--- a/ci/docker/cuda-9.1-cpp.dockerfile
+++ b/ci/docker/cuda-9.1-cpp.dockerfile
@@ -39,6 +39,7 @@ RUN apt-get update -y -q && \
flex \
g++ \
gcc \
+ gdb \
git \
libboost-filesystem-dev \
libboost-regex-dev \
diff --git a/ci/docker/debian-10-cpp.dockerfile b/ci/docker/debian-10-cpp.dockerfile
index e3d6406ff9..c188778d05 100644
--- a/ci/docker/debian-10-cpp.dockerfile
+++ b/ci/docker/debian-10-cpp.dockerfile
@@ -29,6 +29,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
cmake \
g++ \
gcc \
+ gdb \
git \
libbenchmark-dev \
libboost-all-dev \
diff --git a/ci/docker/ubuntu-14.04-cpp.dockerfile b/ci/docker/ubuntu-14.04-cpp.dockerfile
index c8b1ee513c..39ebacd413 100644
--- a/ci/docker/ubuntu-14.04-cpp.dockerfile
+++ b/ci/docker/ubuntu-14.04-cpp.dockerfile
@@ -31,6 +31,7 @@ RUN apt-get update -y -q && \
flex \
g++ \
gcc \
+ gdb \
git \
libbz2-dev \
libgoogle-glog-dev \
diff --git a/ci/docker/ubuntu-16.04-cpp.dockerfile b/ci/docker/ubuntu-16.04-cpp.dockerfile
index 4f0f30b2f9..78c446904b 100644
--- a/ci/docker/ubuntu-16.04-cpp.dockerfile
+++ b/ci/docker/ubuntu-16.04-cpp.dockerfile
@@ -36,6 +36,7 @@ RUN apt-get update -y -q && \
flex \
g++ \
gcc \
+ gdb \
git \
libboost-all-dev \
libbrotli-dev \
diff --git a/ci/docker/ubuntu-18.04-cpp.dockerfile b/ci/docker/ubuntu-18.04-cpp.dockerfile
index 89a776123b..790b2a51fb 100644
--- a/ci/docker/ubuntu-18.04-cpp.dockerfile
+++ b/ci/docker/ubuntu-18.04-cpp.dockerfile
@@ -61,6 +61,7 @@ RUN apt-get update -y -q && \
flex \
g++ \
gcc \
+ gdb \
git \
libbenchmark-dev \
libboost-filesystem-dev \
diff --git a/ci/scripts/cpp_test.sh b/ci/scripts/cpp_test.sh
index e564353430..16f0cd24d0 100755
--- a/ci/scripts/cpp_test.sh
+++ b/ci/scripts/cpp_test.sh
@@ -28,8 +28,6 @@ export ARROW_TEST_DATA=${arrow_dir}/testing/data
export PARQUET_TEST_DATA=${source_dir}/submodules/parquet-testing/data
export LD_LIBRARY_PATH=${ARROW_HOME}/${CMAKE_INSTALL_LIBDIR:-lib}:${LD_LIBRARY_PATH}
-pushd ${build_dir}
-
case "$(uname)" in
Linux)
n_jobs=$(nproc)
@@ -41,6 +39,9 @@ case "$(uname)" in
n_jobs=1
;;
esac
+
+pushd ${build_dir}
+
ctest --output-on-failure -j${n_jobs}
if [ "${ARROW_FUZZING}" == "ON" ]; then
diff --git a/ci/scripts/util_coredump.sh b/ci/scripts/util_coredump.sh
deleted file mode 100644
index 8ca49b4925..0000000000
--- a/ci/scripts/util_coredump.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-set -ex
-
-# TODO(kszucs): GitHub actions doesn't use this file yet, but we should enable
-# automatic backtrace generation for at least the C++ based builds.
-
-# Enable core files
-ulimit -c unlimited -S
-
-if [[ "${TRAVIS_OS_NAME}" = "osx" ]]; then
- COREFILE=$(find /cores -maxdepth 1 -type f -name "core.*" | head -n 1)
- if [[ -f "$COREFILE" ]]; then
- lldb -c "$COREFILE" --batch --one-line "thread backtrace all -e true"
- fi
- ls -la ~/Library/Logs/DiagnosticReports/
- cat ~/Library/Logs/DiagnosticReports/*.crash
-else
- ls -fd1 /tmp/core.*
- COREFILE=$(ls -fd1 /tmp/core.* | head -n 1)
- if [[ -f "$COREFILE" ]]; then
- gdb -c "$COREFILE" $TRAVIS_BUILD_DIR/current-exe -ex "thread apply all bt" -ex "set pagination 0" -batch
- fi
-fi
diff --git a/docker-compose.yml b/docker-compose.yml
index 366ac0e998..2f043895ee 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -15,17 +15,46 @@
# specific language governing permissions and limitations
# under the License.
-# The environment variables referenced from this docker-compose can be set by
-# defining them before running docker-compose, the defaults are set in .env
-# file.
+# Usage
+# -----
+#
+# The docker compose file is parametrized using environment variables, the
+# defaults are set in .env file.
#
# Example:
# $ ARCH=arm64v8 docker-compose build ubuntu-bionic-cpp
# $ ARCH=arm64v8 docker-compose run ubuntu-bionic-cpp
+#
+#
+# Coredumps
+# ---------
+#
+# In order to enable coredumps for the C++ tests run by CTest either with
+# command `make unittest` or `ctest --output-on-failure` the correct coredump
+# patterns must be set.
+# The kernel settings are coming from the host, so while it can be enabled from
+# a running container using --priviled option the change will affect all other
+# containers, so prefer setting it explicitly, directly on the host.
+# WARNING: setting this will affect the host machine.
+#
+# Linux host:
+# $ sudo sysctl -w kernel.core_pattern=core.%e.%p
+#
+# macOS host running Docker for Mac (won't persist between restarts):
+# $ screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
+# # echo "core.%e.%p" > /proc/sys/kernel/core_pattern
+#
+# The setup attempts to generate coredumps by default, but the correct paths
+# above must be set. In order to disable the coredump generation set
+# ULIMIT_CORE environment variable to 0 before running docker-compose
+# (or by setting it in .env file):
+#
+# ULIMIT_CORE=0 docker-compose run --rm conda-cpp
+#
+# See more in cpp/build-support/run-test.sh::print_coredumps
version: '3.5'
-# TODO(kszucs): add .ccache to the mounts
volumes:
# Named volumes must be predefined, so in order to use other architecture,
# like ARM64v8 with debian 10, then the appropriate parametrized volume name
@@ -82,6 +111,8 @@ services:
arch: ${ARCH}
prefix: /opt/conda
shm_size: &shm-size 2G
+ ulimits: &ulimits
+ core: ${ULIMIT_CORE}
environment:
<<: *ccache
ARROW_ENABLE_TIMING_TESTS: # inherit
@@ -139,6 +170,7 @@ services:
cache_from:
- ${REPO}:${ARCH}-cuda-${CUDA}-cpp
shm_size: *shm-size
+ ulimits: *ulimits
environment:
<<: *ccache
ARROW_ENABLE_TIMING_TESTS: # inherit
@@ -166,6 +198,7 @@ services:
args:
arch: ${ARCH}
shm_size: *shm-size
+ ulimits: *ulimits
environment:
<<: *ccache
ARROW_ENABLE_TIMING_TESTS: # inherit
@@ -190,6 +223,7 @@ services:
args:
arch: ${ARCH}
shm_size: *shm-size
+ ulimits: *ulimits
environment:
<<: *ccache
ARROW_ENABLE_TIMING_TESTS: # inherit
@@ -246,6 +280,7 @@ services:
args:
arch: ${ARCH}
shm_size: *shm-size
+ ulimits: *ulimits
environment:
<<: *ccache
ARROW_ENABLE_TIMING_TESTS: # inherit
@@ -272,11 +307,11 @@ services:
- ${REPO}:${ARCH}-debian-${DEBIAN}-c-glib
args:
base: ${REPO}:${ARCH}-debian-${DEBIAN}-cpp
- environment:
- ARROW_GLIB_GTK_DOC: "true"
shm_size: *shm-size
+ ulimits: *ulimits
environment:
<<: *ccache
+ ARROW_GLIB_GTK_DOC: "true"
volumes: *debian-volumes
command: &c-glib-command >
/bin/bash -c "
@@ -300,6 +335,8 @@ services:
- ${REPO}:${ARCH}-ubuntu-${UBUNTU}-c-glib
args:
base: ${REPO}:${ARCH}-ubuntu-${UBUNTU}-cpp
+ shm_size: *shm-size
+ ulimits: *ulimits
environment:
<<: *ccache
ARROW_GLIB_GTK_DOC: "true"
@@ -501,6 +538,7 @@ services:
args:
base: ${REPO}:${ARCH}-ubuntu-${UBUNTU}-cpp
cmake: 3.2.3
+ ulimits: *ulimits
environment:
<<: *ccache
ARROW_ORC: "OFF"