Check Ahead
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.
Check Ahead
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.