Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix api session memory leak in router. Fixes #2669 #2670

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,36 +74,36 @@ return an HTTP status of 429.
* github.com/openziti/agent: [v1.0.20 -> v1.0.23](https://github.com/openziti/agent/compare/v1.0.20...v1.0.23)
* github.com/openziti/channel/v3: [v3.0.16 -> v3.0.26](https://github.com/openziti/channel/compare/v3.0.16...v3.0.26)
* github.com/openziti/edge-api: [v0.26.35 -> v0.26.38](https://github.com/openziti/edge-api/compare/v0.26.35...v0.26.38)
* [Issue #138](https://github.com/openziti/edge-api/issues/138) - management api deletes were generally not mapping 404 properly
* [Issue #138](https://github.com/openziti/edge-api/issues/138) - management api deletes were generally not mapping 404 properly

* github.com/openziti/foundation/v2: [v2.0.52 -> v2.0.56](https://github.com/openziti/foundation/compare/v2.0.52...v2.0.56)
* github.com/openziti/identity: [v1.0.90 -> v1.0.94](https://github.com/openziti/identity/compare/v1.0.90...v1.0.94)
* github.com/openziti/metrics: [v1.2.61 -> v1.2.65](https://github.com/openziti/metrics/compare/v1.2.61...v1.2.65)
* github.com/openziti/runzmd: [v1.0.55 -> v1.0.59](https://github.com/openziti/runzmd/compare/v1.0.55...v1.0.59)
* github.com/openziti/secretstream: [v0.1.26 -> v0.1.28](https://github.com/openziti/secretstream/compare/v0.1.26...v0.1.28)
* github.com/openziti/storage: [v0.3.8 -> v0.3.15](https://github.com/openziti/storage/compare/v0.3.8...v0.3.15)
* [Issue #91](https://github.com/openziti/storage/issues/91) - Support dashes in identifier segments after the first dot
* [Issue #91](https://github.com/openziti/storage/issues/91) - Support dashes in identifier segments after the first dot

* github.com/openziti/transport/v2: [v2.0.153 -> v2.0.159](https://github.com/openziti/transport/compare/v2.0.153...v2.0.159)
* github.com/openziti/ziti: [v1.2.2 -> v1.2.3](https://github.com/openziti/ziti/compare/v1.2.2...v1.2.3)
* [Issue #2659](https://github.com/openziti/ziti/issues/2659) - OIDC Login Panics On Unsupported Media Type
* [Issue #2582](https://github.com/openziti/ziti/issues/2582) - An endpoint to determine whether a node is a raft leader
* [Issue #2619](https://github.com/openziti/ziti/issues/2619) - Add source id to all events
* [Issue #2644](https://github.com/openziti/ziti/issues/2644) - enhance mismapped external identity logging
* [Issue #2636](https://github.com/openziti/ziti/issues/2636) - Enable HA smoketest
* [Issue #2586](https://github.com/openziti/ziti/issues/2586) - Ziti Controller in HA mode doesn't update binding address in a bolt database after config changed
* [Issue #2639](https://github.com/openziti/ziti/issues/2639) - Change cluster events namespace from fabric.cluster to cluster
* [Issue #2184](https://github.com/openziti/ziti/issues/2184) - Add Event(s) For Controller Leader Connection State
* [Issue #2548](https://github.com/openziti/ziti/issues/2548) - Generate a log message if the cluster is without a leader for some configurable period of time
* [Issue #2624](https://github.com/openziti/ziti/issues/2624) - Remove uri/params from connect events
* [Issue #2596](https://github.com/openziti/ziti/issues/2596) - Add DisableRouterDataModel config flag to controller
* [Issue #2599](https://github.com/openziti/ziti/issues/2599) - Routers should only stream model data from one controller
* [Issue #2232](https://github.com/openziti/ziti/issues/2232) - Standardized REST API Error For Mutation on Non-Consensus Controller
* [Issue #2566](https://github.com/openziti/ziti/issues/2566) - Remove HA config flag from router
* [Issue #2550](https://github.com/openziti/ziti/issues/2550) - Router Data Model Chaos Test
* [Issue #2625](https://github.com/openziti/ziti/issues/2625) - edge sessions for an ERT may not be cleaned up when the ER/T is deleted
* [Issue #2591](https://github.com/openziti/ziti/issues/2591) - Split Edge APIs can cause `ziti edge login` to fail

* [Issue #2669](https://github.com/openziti/ziti/issues/2669) - Router api session tracker leaks memory.
* [Issue #2659](https://github.com/openziti/ziti/issues/2659) - OIDC Login Panics On Unsupported Media Type
* [Issue #2582](https://github.com/openziti/ziti/issues/2582) - An endpoint to determine whether a node is a raft leader
* [Issue #2619](https://github.com/openziti/ziti/issues/2619) - Add source id to all events
* [Issue #2644](https://github.com/openziti/ziti/issues/2644) - enhance mismapped external identity logging
* [Issue #2636](https://github.com/openziti/ziti/issues/2636) - Enable HA smoketest
* [Issue #2586](https://github.com/openziti/ziti/issues/2586) - Ziti Controller in HA mode doesn't update binding address in a bolt database after config changed
* [Issue #2639](https://github.com/openziti/ziti/issues/2639) - Change cluster events namespace from fabric.cluster to cluster
* [Issue #2184](https://github.com/openziti/ziti/issues/2184) - Add Event(s) For Controller Leader Connection State
* [Issue #2548](https://github.com/openziti/ziti/issues/2548) - Generate a log message if the cluster is without a leader for some configurable period of time
* [Issue #2624](https://github.com/openziti/ziti/issues/2624) - Remove uri/params from connect events
* [Issue #2596](https://github.com/openziti/ziti/issues/2596) - Add DisableRouterDataModel config flag to controller
* [Issue #2599](https://github.com/openziti/ziti/issues/2599) - Routers should only stream model data from one controller
* [Issue #2232](https://github.com/openziti/ziti/issues/2232) - Standardized REST API Error For Mutation on Non-Consensus Controller
* [Issue #2566](https://github.com/openziti/ziti/issues/2566) - Remove HA config flag from router
* [Issue #2550](https://github.com/openziti/ziti/issues/2550) - Router Data Model Chaos Test
* [Issue #2625](https://github.com/openziti/ziti/issues/2625) - edge sessions for an ERT may not be cleaned up when the ER/T is deleted
* [Issue #2591](https://github.com/openziti/ziti/issues/2591) - Split Edge APIs can cause `ziti edge login` to fail

# Release 1.2.2

Expand Down
4 changes: 4 additions & 0 deletions router/state/apiSessionAdded.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ func (h *apiSessionAddedHandler) HandleReceive(msg *channel.Message, ch channel.
}

func (h *apiSessionAddedHandler) applySync(tracker *apiSessionSyncTracker) {
h.trackerLock.Lock()
defer h.trackerLock.Unlock()

lastId := ""
apiSessions := tracker.all()
for _, apiSession := range apiSessions {
Expand All @@ -121,6 +124,7 @@ func (h *apiSessionAddedHandler) applySync(tracker *apiSessionSyncTracker) {

h.sm.RemoveMissingApiSessions(apiSessions, lastId)
h.sm.MarkSyncStopped(tracker.syncId)
h.syncTracker = nil

tracker.isDone.Store(true)
duration := tracker.endTime.Sub(tracker.startTime)
Expand Down
2 changes: 1 addition & 1 deletion router/state/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ func (sm *ManagerImpl) MarkSyncStopped(trackerId string) {
func (sm *ManagerImpl) IsSyncInProgress() bool {
sm.syncLock.Lock()
defer sm.syncLock.Unlock()
return sm.currentSync == ""
return sm.currentSync != ""
}

func (sm *ManagerImpl) AddApiSession(apiSession *ApiSession) {
Expand Down
Loading