Confluence does not automatically close synchrony heartbeat sockets causing socket accumulation

XMLWordPrintable

    • 2
    • Severity 2 - Major
    • 1

      Issue Summary

      In Confluence 8.5.x+, Confluence's heartbeat http requests to synchrony every 3 seconds are not being closed correctly, causing the opened sockets to increase every 3 seconds.

      Steps to Reproduce

      In Confluence 8.5.x and later:

      1. Find the pid of confluence process
      2. Create a shell script as below based on system type. and add execution permission to it (chmod +x )
      3. Run below shell script with the above pid
      4. You will notice that the socket number is increasing every 3 seconds

      linux env

      #!/bin/bash
      PID=$1
      THRESHOLD=100  # warning threshold
      
      if [ ! -d "/proc/$PID/fd" ]; then
        echo "process $PID not exists or no permission"
        exit 1
      fi
      
      while true; do
        socket_count=$(sudo ls -l /proc/$PID/fd 2>/dev/null | grep -c 'socket:\[')
        echo "$(date): PID $PID current open socket number: $socket_count"
      
        if [ "$socket_count" -gt "$THRESHOLD" ]; then
          echo "⚠️ warning: socket over threshold $THRESHOLD!"
        fi
      
        sleep 2
      done

       

      mac env

      #!/bin/bash
      PID=$1
      THRESHOLD=100  # warning threshold
      
      while true; do
        socket_count=$(lsof -p $PID | grep '8091' | wc -l)
        echo "$(date): PID $PID current open socket number: $socket_count"
      
        if [ "$socket_count" -gt "$THRESHOLD" ]; then
          echo "⚠️ warning: socket over threshold $THRESHOLD!"
        fi
      
        sleep 2
      done 

      Expected Results

      The sockets are automatically closed and do not accumulate

      Actual Results

      Sockets accumulate until garbage collection clears them out. Triggering garbage collection can also clear the sockets on demand.

      Workaround

      increase the maximum open file limit if needed

            Assignee:
            Unassigned
            Reporter:
            Robert Louie
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: