-
Type: Bug
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Background & Motivation
libmongoc does not call a callback registered with mongoc_apm_set_server_closed_cb when a mongoc_client_t or mongoc_client_pool_t is destroyed.
This appears to contradict the SDAM Monitoring specification's definition os ServerClosedEvent
ServerClosedEvent Published when the server monitor’s connection is closed and the server is shutdown.
libmongoc does emit the ServerClosedEvent in the following situations:
1. A server is removed from the topology description when processing a server description. This follows the SDAM topology type table. This occurs in _mongoc_topology_description_remove_server.
2. A mongoc_client_t or mongoc_client_pool_t connected to a load balanced topology is being destroyed. This occurs in _mongoc_topology_description_monitor_closed.
This can be observed with example-sdam-monitoring.
./cmake-build/src/libmongoc/example-sdam-monitoring "mongodb://localhost:27017"
Events:
server changed: 1
server opening: 1
server closed: 0
topology changed: 2
topology opening: 1
topology closed: 1
heartbeat started: 1
heartbeat succeeded: 1
heartbeat failed: 0
Scope
Use _mongoc_topology_description_monitor_server_closed to emit a ServerClosedEvent for each server being monitored when a mongoc_client_t or mongoc_client_pool_t is being destroyed.
Add tests to ensure server closed events are emitted. This may not be necessary if DRIVERS-1087 is complete before this ticket. SPEC-1280 proposes adding specification tests to test this behavior.
- is depended on by
-
PHPC-2461 Allow observation of ServerClosedEvents during client shutdown
- Blocked
- is related to
-
DRIVERS-1087 Specify and test SDAM events
- Backlog