Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-4778

NotificationService should not keep same DB session forever

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.7.2
    • Fix Version/s: 3.7.3, 4.0
    • Component/s: Notifications
    • Labels:
      None

      Description

      Steps to reproduce:

      • Set MySQL wait_timeout to a short value: SET @@GLOBAL.wait_timeout=10;
      • Start SonarQube server
      • Send a first notification (update an issue) => session is opened and attached to NotificationService thread
      • Wait for 10 seconds until idle connection is closed by MySQL server
      • Try to send another notification => NotificationService try to reuse same previous session but underlying connection is closed => error
        WARN  o.s.s.n.NotificationService  Unable to deliver notification Notification
        [...]
        Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
        
        The last packet successfully received from the server was 181 088 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
        

      In real life it occurs when the NotificationManager didn't send email in a period exceeding MySQL wait_timeout.

      There is an easy fix that is to always close session after each execution of the NotificationService. This way during next "wake-up" of the NotificationService a fresh new session will be created and a new connection requested from the pool.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              henryju OLD - Julien HENRY
              Reporter:
              henryju OLD - Julien HENRY
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: