mirror of https://github.com/mongodb/mongo
SERVER-113605: Set coredump kernel param on container initialization (#43743)
GitOrigin-RevId: 86c3873be8e3b721990fae3af9681bd0cbd1c108
This commit is contained in:
parent
6be3b3cec1
commit
fd3b0ab6a4
|
|
@ -3,6 +3,7 @@
|
|||
"runArgs": [
|
||||
"--name=mongo-dev-${containerWorkspaceFolderBasename}-${devcontainerId}"
|
||||
],
|
||||
"initializeCommand": "${localWorkspaceFolder}/.devcontainer/initialize.sh",
|
||||
"build": {
|
||||
"dockerfile": "./Dockerfile",
|
||||
"context": "..",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
# MongoDB Development Container Host Initialization Script
|
||||
# This script runs on the host machine before the container starts.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Configure core dump pattern in the Docker VM
|
||||
# This is a kernel-level setting that cannot be modified from within unprivileged containers,
|
||||
# so we use nsenter to enter the Docker VM's mount namespace and set it there.
|
||||
echo "Configuring core dump pattern in Docker VM..."
|
||||
docker run --rm --privileged --pid=host \
|
||||
alpine:3.22.2@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 \
|
||||
nsenter -t 1 -m -- sh -c "echo 'dump_%e.%p.core' > /proc/sys/kernel/core_pattern" \
|
||||
2>/dev/null || {
|
||||
echo "Warning: Could not set core dump pattern (this is expected on non-Docker Desktop environments)"
|
||||
}
|
||||
|
||||
echo "Host initialization complete"
|
||||
|
|
@ -96,6 +96,17 @@ devcontainer_run() {
|
|||
devcontainer exec --workspace-folder . --id-label "test-id=${TEST_ID}" --remote-env CI=true "$@"
|
||||
}
|
||||
|
||||
echo "Checking core dump pattern configuration..."
|
||||
CORE_PATTERN=$(devcontainer_run cat /proc/sys/kernel/core_pattern)
|
||||
if [[ "$CORE_PATTERN" == "dump_%e.%p.core" ]]; then
|
||||
echo "✓ Core dump pattern correctly set to: $CORE_PATTERN"
|
||||
else
|
||||
echo "✗ Core dump pattern is: $CORE_PATTERN (expected: dump_%e.%p.core)"
|
||||
echo " The initializeCommand may have failed to set the kernel parameter"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Checking GCC version..."
|
||||
devcontainer_run gcc --version
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue