Skip to content

Goroutine leak in RegisterView causes memory exhaustion in long-running systems #1318

Closed

Description

@AkramBitar

The RegisterView launches a goroutine that never terminates if public parameters are unavailable or context is cancelled, causing memory leaks in production.

    for {
        pp := tms.PublicParametersManager().PublicParameters()
        if pp == nil {
            logger.Debugf("public parameters not yet available, wait...")
            time.Sleep(500 * time.Millisecond)
            continue
        }
        logger.Debugf("public parameters available, set certification service...")
        if err := r.startCertificationService(context, tms, pp); err != nil {
            logger.Errorf("failed to start certification service [%s]", err)
        }
        break
    }
}()

Problems:

  1. No timeout - runs forever if parameters never arrive
  2. No context cancellation check - ignores context.Context().Done()
  3. No cleanup mechanism - cannot be stopped once started
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions