Adjust fullnode/drone oom_score_adj to goad the kernel into killing it first
This commit is contained in:
		@@ -173,6 +173,21 @@ tune_networking() {
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
oom_score_adj() {
 | 
			
		||||
  declare pid=$1
 | 
			
		||||
  declare score=$2
 | 
			
		||||
  if [[ $(uname) != Linux ]]; then
 | 
			
		||||
    return
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  (
 | 
			
		||||
    echo "$score" > "/proc/$pid/oom_score_adj"
 | 
			
		||||
    if [[ $score != $(cat "/proc/$pid/oom_score_adj") ]]; then
 | 
			
		||||
      echo "Failed to set oom_score_adj for pid $pid"
 | 
			
		||||
    fi
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SOLANA_CONFIG_DIR=${SNAP_DATA:-$PWD}/config
 | 
			
		||||
SOLANA_CONFIG_PRIVATE_DIR=${SNAP_DATA:-$PWD}/config-private
 | 
			
		||||
SOLANA_CONFIG_VALIDATOR_DIR=${SNAP_DATA:-$PWD}/config-validator
 | 
			
		||||
 
 | 
			
		||||
@@ -42,4 +42,5 @@ $solana_drone \
 | 
			
		||||
  -l "$SOLANA_CONFIG_DIR"/leader.json -k "$SOLANA_CONFIG_PRIVATE_DIR"/mint.json \
 | 
			
		||||
  > >($drone_logger) 2>&1 &
 | 
			
		||||
pid=$!
 | 
			
		||||
oom_score_adj "$pid" 1000
 | 
			
		||||
wait "$pid"
 | 
			
		||||
 
 | 
			
		||||
@@ -31,4 +31,5 @@ $program \
 | 
			
		||||
  --ledger "$SOLANA_CONFIG_DIR"/ledger \
 | 
			
		||||
  > >($leader_logger) 2>&1 &
 | 
			
		||||
pid=$!
 | 
			
		||||
oom_score_adj "$pid" 1000
 | 
			
		||||
wait "$pid"
 | 
			
		||||
 
 | 
			
		||||
@@ -108,4 +108,5 @@ $program \
 | 
			
		||||
  --ledger "$SOLANA_LEADER_CONFIG_DIR"/ledger \
 | 
			
		||||
  > >($validator_logger) 2>&1 &
 | 
			
		||||
pid=$!
 | 
			
		||||
oom_score_adj "$pid" 1000
 | 
			
		||||
wait "$pid"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user