[ https://issues.apache.org/jira/browse/CASSANDRA-12461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15428541#comment-15428541 ]
Alex Petrov commented on CASSANDRA-12461: ----------------------------------------- bq. It is a great way to introduce stupid bugs and the performance benefits here would be nonexistent. I was actually advocating for correctness. With a volatile variable we won't be able to guarantee exactly-once (we could with locking but it's usually much harder). If you're still against it even in that case, I'll take a look at locking version you implemented again as I think we should guard the boolean variable, as it'd already protect the access to lists. Either way works for me, we should just make sure that list accessors (both add and remove) disallow modifying lists after shutdown hook is ran. bq. I only smoke tested things on a shutdown, I'm wondering if that error has to do with the shutdown hook for logback being called twice. I'll test that case today. As far as I remember, this error showed up during "normal" shutdown (interrupt). And during drain (I've tested by adding some println hooks), I just seen all messages duplicated (which is kind of clear from the logic), but I'd argue that running whole process twice is not required. And if we do run hooks, we most likely should run them once (?), which would be during "normal" shutdown. > Add hooks to StorageService shutdown > ------------------------------------ > > Key: CASSANDRA-12461 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12461 > Project: Cassandra > Issue Type: Bug > Reporter: Anthony Cozzie > Assignee: Anthony Cozzie > Attachments: > 0001-CASSANDRA-12461-add-C-support-for-shutdown-runnables.patch > > > The JVM will usually run shutdown hooks in parallel. This can lead to > synchronization problems between Cassandra, services that depend on it, and > services it depends on. This patch adds some simple support for shutdown > hooks to StorageService. > This should nearly solve CASSANDRA-12011 -- This message was sent by Atlassian JIRA (v6.3.4#6332)