Skip to content

Conversation

@jcabrero
Copy link
Member

@jcabrero jcabrero commented Jul 22, 2025

This PR changes the code to make sure the nv_trust only creates the client once and adds the verifier once. Otherwise, we cause the attester to be attached to a global instance and to be recreated multiple times. This makes the attestation to take exponentially more time, as more verifiers produce the attestation (though one is only produced).

The code is reorganized to ensure the client is only created once.

@jcabrero jcabrero force-pushed the fix/attestation_memory_leak branch from 45ac66d to 327e6b6 Compare July 22, 2025 17:09
@jcabrero jcabrero requested review from blefo, Copilot and crypblizz8 July 22, 2025 17:11
@jcabrero jcabrero marked this pull request as ready for review July 22, 2025 17:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a memory-leak-like performance issue in the NVIDIA Trust attestation system by ensuring the attestation client and verifier are created only once instead of being recreated multiple times, which was causing exponential slowdown.

  • Centralizes client creation in a new get_client() function with @lru_cache to ensure singleton behavior
  • Removes duplicate client configuration code from attester and verifier modules
  • Consolidates shared functionality and constants into the __init__.py module

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/nilai-common/src/nilai_common/logger.py Removes unused default logger instance
nilai-attestation/src/nilai_attestation/attestation/nvtrust/__init__.py Adds centralized client creation with caching and shared utilities
nilai-attestation/src/nilai_attestation/attestation/nvtrust/nv_attester.py Refactors to use centralized client creation and removes duplicate code
nilai-attestation/src/nilai_attestation/attestation/nvtrust/nv_verifier.py Updates to use centralized client creation and removes hardcoded name parameter
nilai-attestation/src/nilai_attestation/app.py Adds logging configuration to suppress verbose SDK output

@jcabrero jcabrero force-pushed the fix/attestation_memory_leak branch from 327e6b6 to 9bde71e Compare July 23, 2025 07:40
@jcabrero jcabrero merged commit 6aca112 into main Jul 23, 2025
5 checks passed
@jcabrero jcabrero deleted the fix/attestation_memory_leak branch July 31, 2025 09:14
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.

3 participants