Skip to content

Thread Safety: Add concurrency stress tests for Component and Container #258

Description

@sfloess

Part of #224: Improve Thread Safety in Component and Container

Scope

Create targeted concurrency stress tests to validate thread safety fixes from the other sub-issues and prevent regressions.

Tests Needed

  • Concurrent setParent() + repaint() on same Component
  • Concurrent Container.add() + Container.remove() + repaint()
  • Concurrent setTerminalSize() + rendering operations
  • Concurrent drawBorder() + dimension changes
  • Concurrent mouse event handling with listener modifications
  • modificationCount visibility under contention

Approach

  • Use ExecutorService with multiple threads hammering shared components
  • Run each scenario for N iterations (e.g., 10,000)
  • Assert no exceptions, no deadlocks (timeout-based detection), consistent state
  • Consider using JCStress or similar concurrency testing framework

Acceptance Criteria

  • Stress tests exist for each critical concurrent scenario
  • Tests reliably detect the races fixed by sibling sub-issues (verify by running against unfixed code if feasible)
  • Tests run in CI without flakiness
  • No deadlocks detected under stress

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogFuture enhancement for later consideration

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions