1
0
mirror of synced 2025-12-31 06:05:12 -05:00
Files
airbyte/airbyte-integrations/bases/base-java/javabase.sh
Eugene 8c84ad2976 🎉Source-postgres\mssql\mysql added a HEAP dump capturing on outOfMemory Error (if any) (#8811)
* Updated entrypoint script for source-mysql\mssql\postgres connectors to capture a HEAP dump when connector fails with outOfMemory error
2021-12-28 17:34:35 +02:00

27 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
# if IS_CAPTURE_HEAP_DUMP_ON_ERROR is set to true, then will capture Heap dump on OutOfMemory error
if [[ $IS_CAPTURE_HEAP_DUMP_ON_ERROR = true ]]; then
arrayOfSupportedConnectors=("source-postgres" "source-mssql" "source-mysql" )
# The heap dump would be captured only in case when java-based connector fails with OutOfMemory error
if [[ " ${arrayOfSupportedConnectors[*]} " =~ " $APPLICATION " ]]; then
JAVA_OPTS=$JAVA_OPTS" -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/dump.hprof"
export JAVA_OPTS
echo "Added JAVA_OPTS=$JAVA_OPTS"
echo "APPLICATION=$APPLICATION"
fi
fi
# Wrap run script in a script so that we can lazy evaluate the value of APPLICATION. APPLICATION is
# set by the dockerfile that inherits base-java, so it cannot be evaluated when base-java is built.
# We also need to make sure that stdin of the script is piped to the stdin of the java application.
if [[ $A = --write ]]; then
cat <&0 | /airbyte/bin/"$APPLICATION" "$@"
else
/airbyte/bin/"$APPLICATION" "$@"
fi