Skip to content

fix(xnoded): fix error msg when creating xnode#34503

Merged
zitsen merged 1 commit intomainfrom
fix/zgc-6735485359-main
Feb 5, 2026
Merged

fix(xnoded): fix error msg when creating xnode#34503
zitsen merged 1 commit intomainfrom
fix/zgc-6735485359-main

Conversation

@acerDebugman
Copy link
Copy Markdown
Contributor

Closes 6735485359

Description

Issue(s)

  • Close/close/Fix/fix/Resolve/resolve: Issue Link

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 @acerDebugman, 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 primarily focuses on enhancing the robustness and reliability of the xnoded component. It addresses issues related to xnode creation, improves path handling for xnoded files, refines process management logic for better stability during startup and shutdown, and adds a crucial check for socket path availability to prevent misleading error messages. Additionally, a test case has been made more stable by introducing a delay.

Highlights

  • Xnode Creation Logic Refinement: The logic for creating xnodes has been adjusted to ensure the mndCreateXnode function is called at the appropriate time, preventing potential issues with uninitialized tokens.
  • Robust Xnoded Path Handling: Path generation for xnoded pipes and PID files has been improved to correctly handle cases where the data directory path might end with a slash, preventing malformed paths.
  • Enhanced Xnoded Process Management: The xnoded process exit handling now includes SIGINT and SIGTERM as valid termination signals, and sleep durations during startup and restart have been fine-tuned for better stability.
  • Improved Xnode Request Error Handling: A check has been added to verify the existence of the xnoded socket path before attempting to send requests, providing clearer error messages when the socket is not available.
  • Test Stability Improvement: A sleep delay was introduced in the test_alter_token test case to ensure that xnode creation and transaction commits are fully processed before querying, enhancing test reliability.

🧠 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/dnode/mnode/impl/src/mndXnode.c
    • Reordered the call to mndCreateXnode within mndProcessCreateXnodeReq to ensure createReq.token.ptr is always initialized before subsequent operations.
    • Added a check using taosCheckExistFile for the xnoded socket path before sending requests, returning TSDB_CODE_MND_XNODE_URL_CANT_ACCESS if the path does not exist.
  • source/dnode/xnode/src/xnode.c
    • Modified getXnodedPipeName to conditionally add a slash between tsDataDir and XNODED_MGMT_LISTEN_PIPE_NAME_PREFIX only if tsDataDir does not already end with one, preventing double slashes.
  • source/libs/txnode/src/txnodeMgmt.c
    • Modified getXnodedPidPath to conditionally add a slash between tsDataDir and XNODED_XNODED_PID_NAME only if tsDataDir does not already end with one, preventing double slashes.
    • Changed the logging level for xnoded process exit messages from xndDebug to xndInfo.
    • Expanded the conditions for a successful xnoded exit in xnodeMgmtXnodedExit to include SIGINT and SIGTERM signals.
    • Adjusted uv_sleep durations in xnodeMgmtXnodedExit (from 1000ms to 500ms) and xnodeMgmtStartXnoded (added 100ms) to optimize timing during xnoded restarts and startup.
  • test/cases/42-Xnode/test_xnode.py
    • Added a time.sleep(1) after CREATE XNODE command in test_alter_token to ensure the xnode is fully created and the transaction committed before querying.
Activity
  • The pull request aims to close defect 6735485359.
  • The author has provided a checklist for manual updates, test cases, and test coverage, which are currently unchecked.
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 primarily fixes an issue with error messaging during xnode creation by refactoring the creation logic and adding pre-checks for socket file existence. It also improves robustness by handling trailing slashes in paths and refining the xnoded process management logic, including exit signal handling and sleep durations. However, a critical security issue was identified: the use of a hardcoded secret for signing agent tokens, which should be moved to a secure configuration. Additionally, there's a potential buffer over-read in path handling due to unsafe use of strlen, and a fragile race condition fix using uv_sleep.

@acerDebugman acerDebugman force-pushed the fix/zgc-6735485359-main branch from c313e2b to e7fcee0 Compare February 4, 2026 15:43
@zitsen zitsen merged commit e050ca0 into main Feb 5, 2026
11 of 12 checks passed
@zitsen zitsen deleted the fix/zgc-6735485359-main branch February 5, 2026 03:20
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.

2 participants