- Notifications
You must be signed in to change notification settings - Fork 983
fix(core): avoid leaking Node.js types via unrefTimer() util #5986
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
Merged
pichlermarc merged 6 commits into open-telemetry:main from dynatrace-oss-contrib:fix/unref-timer-type-leak Oct 8, 2025
+43 −15
Merged
Changes from all commits
Commits
Show all changes
6 commits Select commit Hold shift + click to select a range
6c6edef fix(core): avoid leaking Node.js types via unrefTimer() util
pichlermarc 6d611bb fixup! fix(core): avoid leaking Node.js types via unrefTimer() util
pichlermarc 8d75163 chore: update changelog.md
pichlermarc f66dc12 test(core): add test to appease codecov
pichlermarc 6efcc87 Merge branch 'main' into fix/unref-timer-type-leak
pichlermarc 1b4d530 Merge branch 'main' into fix/unref-timer-type-leak
pichlermarc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -13,6 +13,13 @@ | |
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| export function unrefTimer(timer: NodeJS.Timer): void { | ||
| timer.unref(); | ||
| | ||
| /** | ||
| * @deprecated please copy this code to your implementation instead, this function will be removed in the next major version of this package. | ||
| * @param timer | ||
| */ | ||
| export function unrefTimer(timer: { unref(): unknown } | number): void { | ||
| Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering if it is worth to keep this and make the argument a | ||
| if (typeof timer !== 'number') { | ||
| timer.unref(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are removing
NodeJS.Timertype insrc/common/timer-util.tsbut this private property still holdsNodeJS.Timeout. I've checked the type signature and saw thatNodeJS.TimeoutextendsNodeJS.Timer. Should we replace the type here as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be safe to keep. The private property's type gets erased in the final type definition. As a consequence,
/// <reference types="node" />does not end up in theBatchLogRecordProcessor.d.ts:)