Skip to content

Fix goroutine leaks#5

Open
Wentao0312 wants to merge 1 commit into
IABTechLab:mainfrom
Wentao0312:fix-goroutine-leaks
Open

Fix goroutine leaks#5
Wentao0312 wants to merge 1 commit into
IABTechLab:mainfrom
Wentao0312:fix-goroutine-leaks

Conversation

@Wentao0312
Copy link
Copy Markdown

Summary

This PR addresses potential goroutine leaks in the DTE library, specifically in:

  • ConfigurationHandler.go
  • ModelResult.go

In certain execution paths, goroutines may be started but are not guaranteed to exit, which can lead to leaks over time in long-running services.

Problem

During integration and testing, we observed behavior consistent with goroutine leaks originating from these components. Over time, this can:

  • increase memory usage
  • leave background goroutines running indefinitely
  • impact system stability under sustained load

Expected behavior

All goroutines spawned by the library should terminate cleanly when:

  • the associated work is completed
  • a timeout or cancellation occurs
  • the caller no longer needs the result

Actual behavior

Some goroutines may remain blocked or alive longer than expected, resulting in resource leakage.

Changes

  • Ensure goroutines have proper termination conditions
  • Add/propagate cancellation handling where needed
  • Prevent goroutines from blocking indefinitely

Notes

This issue was identified during integration in a production-like environment. The changes aim to make goroutine lifecycle management more robust without altering existing functionality.

Happy to iterate further if there are preferred patterns for concurrency management in this project.

@Wentao0312 Wentao0312 changed the title Fix goroutine leaks. Fix goroutine leaks Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant