apache/cassandra · warning

Not executing task on GossipStage - it has shut down

Error message

Not executing task on GossipStage - it has shut down

What it means

Gossiper submits tasks to the GossipStage executor; after gossip has been shut down during node shutdown, the executor rejects new tasks with a RejectedExecutionException whose message mentions 'GossipStage has shut down'. Gossiper detects this and logs a warning instead of propagating the exception, allowing callers like convict/doStatusCheck to unwind cleanly during shutdown.

Source

Thrown at src/java/org/apache/cassandra/gms/Gossiper.java:543

    public static void runInGossipStageBlocking(Runnable runnable)
    {
        // run immediately if we're already in the gossip stage
        if (isInGossipStage())
        {
            runnable.run();
            return;
        }
        FutureTask<?> task = new FutureTask<>(runnable);
        try
        {
            Stage.GOSSIP.execute(task);

        }
        catch (RejectedExecutionException e)
        {
            if (e.getMessage() != null && e.getMessage().contains("GossipStage has shut down"))
            {
                logger.warn("Not executing task on GossipStage - it has shut down", e);
                return;
            }
            else
                throw e;
        }
        try
        {
            task.get();
        }
        catch (InterruptedException e)
        {
            throw new UncheckedInterruptedException(e);
        }
        catch (ExecutionException e)
        {
            throw new AssertionError(e);
        }
    }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Verify this occurs only during shutdown; if seen at runtime, ensure Gossiper.stop() is called only when the node is truly stopping.
  2. Fix ordering in shutdown code: cancel the gossip task before shutting down GossipStage.
  3. If it appears in tests, wait for in-flight gossip tasks to complete before stopping the gossiper.
  4. If a caller throws this at runtime (not the warn path), check that MessagingService/gossip were not shut down prematurely.

Example fix

// before
gossiper.convict(endpoint);
gossiper.stop();
// after
gossiper.stop();
// avoid convict() after stop; guard if needed
if (Gossiper.instance.isEnabled())
    Gossiper.instance.convict(endpoint);
Defensive patterns

Strategy: try-catch

Validate before calling

if (!Gossiper.instance.isEnabled()) { /* skip gossip task */ }

Type guard

boolean gossipAlive = Gossiper.instance != null && Gossiper.instance.isEnabled();

Try / catch

try { Gossiper.instance.convict(ep); } catch (RejectedExecutionException e) { logger.debug("gossip shut down; ignoring", e); }

Prevention

When it happens

Trigger: A gossip-stage task (convict, doStatusCheck, evictIfExpired, onResponse, unsafeBroadcastLeftStatus) is scheduled or run after Gossiper.stop/shutdown has closed the GossipStage executor; the executor throws RejectedExecutionException.

Common situations: Node shutdown or drain while gossip messages or failure-detection timers still fire; test teardown where the gossiper is stopped but background tasks linger; calling Gossiper APIs after StorageService.stopGossiping.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/4e405ab4e7020898. Report an issue: GitHub.