{"record":{"id":"9f8c811202652ab4","repo":"SonarSource/sonarqube","slug":"failed-to-poll-for-push-events","errorCode":null,"errorMessage":"Failed to poll for push events","messagePattern":"Failed to poll for push events","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/scheduler/polling/PushEventPollScheduler.java","lineNumber":79,"sourceCode":"  public PushEventPollScheduler(PushEventExecutorService executorService, SonarLintClientsRegistry clientsRegistry,\n    DbClient dbClient, System2 system2, Configuration config) {\n    this.executorService = executorService;\n    this.clientsRegistry = clientsRegistry;\n    this.dbClient = dbClient;\n    this.system2 = system2;\n    this.config = config;\n  }\n\n  @Override\n  public void start() {\n    this.executorService.scheduleAtFixedRate(this::tryBroadcastEvents, getInitialDelay(), getPeriod(), TimeUnit.SECONDS);\n  }\n\n  private void tryBroadcastEvents() {\n    try {\n      doBroadcastEvents();\n    } catch (Exception e) {\n      LOG.warn(\"Failed to poll for push events\", e);\n    }\n  }\n\n  private void doBroadcastEvents() {\n    var clients = clientsRegistry.getClients();\n    if (clients.isEmpty()) {\n      lastPullTimestamp = null;\n      lastSeenUuid = null;\n      return;\n    }\n\n    if (lastPullTimestamp == null) {\n      lastPullTimestamp = getLastPullTimestamp();\n    }\n\n    var projectUuids = getClientsProjectUuids(clients);\n\n    try (DbSession dbSession = dbClient.openSession(false)) {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-webserver-pushapi/src/main/java/org/sonar/server/pushapi/scheduler/polling/PushEventPollScheduler.java#L61-L97","documentation":"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.","triggerScenarios":"doBroadcastEvents throws any Exception — e.g. clientsRegistry access fails, payload serialization fails, or a downstream broadcast errors — during the scheduled poll.","commonSituations":"No/broken connections to push clients; database errors fetching pending events; serialization bugs after an upgrade introducing a new event payload type.","solutions":["Inspect the attached stack trace `e` for the real failure inside doBroadcastEvents","Check the push clients registry state and connectivity of registered clients","Verify pending push events in the database are not corrupted or of an unsupported type","Confirm the scheduler thread is alive; it self-recovers each period after transient errors"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (clientsRegistry.getClients().isEmpty()) return; // skip cycle when no clients","typeGuard":null,"tryCatchPattern":"try { doBroadcastEvents(); } catch (Exception e) { LOG.warn(\"Failed to poll for push events\", e); }","preventionTips":["Keep the polling loop exception-safe so one bad cycle doesn't kill the scheduler","Validate event payloads before broadcast","Alert on repeated polling failures"],"tags":["push-events","scheduler","polling"],"backgroundTag":"internal-invariant-violation","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}