SonarSource/sonarqube · warning

Failed to poll for push events

Error message

Failed to poll for push events

What it means

PushEventPollScheduler periodically polls and broadcasts push events. tryBroadcastEvents wraps doBroadcastEvents in a broad catch so a failure in one polling cycle is logged and the scheduler survives to the next cycle.

Solutions

  1. Inspect the attached stack trace `e` for the real failure inside doBroadcastEvents
  2. Check the push clients registry state and connectivity of registered clients
  3. Verify pending push events in the database are not corrupted or of an unsupported type
  4. Confirm the scheduler thread is alive; it self-recovers each period after transient errors
Defensive patterns

Strategy: try-catch

Validate before calling

if (clientsRegistry.getClients().isEmpty()) return; // skip cycle when no clients

Try / catch

try { doBroadcastEvents(); } catch (Exception e) { LOG.warn("Failed to poll for push events", e); }

Prevention

When it happens

Trigger: doBroadcastEvents throws any Exception — e.g. clientsRegistry access fails, payload serialization fails, or a downstream broadcast errors — during the scheduled poll.

Common situations: No/broken connections to push clients; database errors fetching pending events; serialization bugs after an upgrade introducing a new event payload type.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/9f8c811202652ab4. Report an issue: GitHub.

Appendix: source

Thrown at server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/scheduler/polling/PushEventPollScheduler.java:79

  public PushEventPollScheduler(PushEventExecutorService executorService, SonarLintClientsRegistry clientsRegistry,
    DbClient dbClient, System2 system2, Configuration config) {
    this.executorService = executorService;
    this.clientsRegistry = clientsRegistry;
    this.dbClient = dbClient;
    this.system2 = system2;
    this.config = config;
  }

  @Override
  public void start() {
    this.executorService.scheduleAtFixedRate(this::tryBroadcastEvents, getInitialDelay(), getPeriod(), TimeUnit.SECONDS);
  }

  private void tryBroadcastEvents() {
    try {
      doBroadcastEvents();
    } catch (Exception e) {
      LOG.warn("Failed to poll for push events", e);
    }
  }

  private void doBroadcastEvents() {
    var clients = clientsRegistry.getClients();
    if (clients.isEmpty()) {
      lastPullTimestamp = null;
      lastSeenUuid = null;
      return;
    }

    if (lastPullTimestamp == null) {
      lastPullTimestamp = getLastPullTimestamp();
    }

    var projectUuids = getClientsProjectUuids(clients);

    try (DbSession dbSession = dbClient.openSession(false)) {

View on GitHub (pinned to 184c821202)