Skip to content

[Bug] Server shutdown leaves metrics exporters bound and subscribers registered #8251

Description

@slievrly

Check Ahead

  • Searched existing issues for metrics exporter lifecycle.
  • Willing to fix.

Issue Description

MetricsManager creates exporters and a MetricsSubscriber but retains neither for shutdown. PrometheusExporter owns an HTTP listener and supports close(), yet ServerRunner never disposes it. After a Spring context restart or SPI cache eviction, the next exporter tries to bind the still-owned port.

Evidence

Java 17 CI job, commit 96e84e5, repeated exporter initialization failures starting around raw line 18760, with BindException: Address already in use. This is normal test-context lifecycle, not an intentional occupied-port test.

Expected behavior

Server shutdown closes owned exporters and unregisters the subscriber. Reinitialization creates live exporters instead of reusing closed SPI instances. Repeated init must not duplicate subscriptions.

Environment

Seata 2.8.0-SNAPSHOT, Java 17, Prometheus exporter enabled.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions