Skip to content

fix(taos): semphore is not destroy#34492

Merged
guanshengliang merged 2 commits intomainfrom
fix/6769316072
Feb 5, 2026
Merged

fix(taos): semphore is not destroy#34492
guanshengliang merged 2 commits intomainfrom
fix/6769316072

Conversation

@wangmm0220
Copy link
Copy Markdown
Contributor

@wangmm0220 wangmm0220 commented Feb 3, 2026

Description

Issue(s)

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @wangmm0220, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical bug where semaphore resources were not being properly destroyed, potentially leading to resource leaks. By enabling the previously commented-out destruction logic within the tsem_destroy function, this change ensures that semaphores are correctly deallocated, improving system stability and resource management.

Highlights

  • Semaphore Destruction Fix: The tsem_destroy function in source/os/src/osSemaphore.c has been enabled to correctly destroy semaphore resources.
  • Resource Deallocation: Previously commented-out code responsible for null checks, releasing dispatch objects, and nullifying pointers within the tsem_destroy function has been reactivated, ensuring proper resource cleanup.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • source/os/src/osSemaphore.c
    • The tsem_destroy function's core logic for releasing semaphore resources and nullifying pointers has been uncommented and activated.
Activity
  • The pull request was opened by wangmm0220.
  • The PR description includes standard sections but lacks specific details regarding the changes or linked issues.
  • The provided checklist items (user manual, test cases, test coverage) are currently unchecked, indicating pending actions or information.
  • No review comments or explicit activity from other contributors have been provided in the context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes a resource leak on macOS (_TD_DARWIN_64) where semaphores were not being destroyed because the tsem_destroy function was effectively a no-op. The change correctly implements the function by calling dispatch_release to free the semaphore and then setting the pointer to NULL to prevent use-after-free issues. This is an important fix. I have one minor suggestion to improve the consistency of error handling. Additionally, you may want to correct the typo in the pull request title ('semphore' -> 'semaphore').

Comment thread source/os/src/osSemaphore.c Outdated
@guanshengliang guanshengliang merged commit 7d325cc into main Feb 5, 2026
12 of 13 checks passed
@guanshengliang guanshengliang deleted the fix/6769316072 branch February 5, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants