Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-11984

StorageService shutdown hook should use a volatile variable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Fix Version/s: 2.2.7, 3.0.8, 3.8
    • Component/s: Legacy/Core
    • Labels:
      None
    • Severity:
      Normal

      Description

      In StorageService.java there is a variable accessed from other threads that is not marked volatile.

        private boolean inShutdownHook = false;
        public boolean isInShutdownHook()
         {
             return inShutdownHook;
         }
        drainOnShutdown = new Thread(new WrappedRunnable()
             {
                 @Override
                 public void runMayThrow() throws InterruptedException
                 {
                     inShutdownHook = true;
      

      This is called from at least here:

      ./src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java:                if (!StorageService.instance.isInShutdownHook())
      

      This could cause issues in controlled shutdown like drain commands.

        Attachments

          Activity

            People

            • Assignee:
              appodictic Edward Capriolo
              Reporter:
              appodictic Edward Capriolo
              Authors:
              Edward Capriolo
              Reviewers:
              Stefania
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: