Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Parasoft Jtest 2021.1

...

Starting and using background threads during class initialization can result in deadlock.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

TSM02-J

Low

Probable

High

P2

L3

Automated Detection

ToolVersionCheckerDescription
CodeSonar Include PageCodeSonar_VCodeSonar_VFB.MT_CORRECTNESS.SC_START_IN_CTORConstructor invokes Thread.start()
Parasoft Jtest
Include Page
Parasoft_V
Parasoft_V
TRS
CERT.TSM02.CSTART
Implemented
Do not call the "start" method of threads from inside a constructor
SonarQube
Include Page
SonarQube_V
SonarQube_V
S2693
 
Threads should not be started in constructors

Bibliography

[Bloch 2005b]

Chapter 8, "Lazy Initialization"

[Grand 2002]

Chapter 5, "Creational Patterns, Singleton"

Issue Tracking

Tasklist
Review List
Review List
||Completed||Priority||Locked||CreatedDate||CompletedDate||Assignee||Name||
|T|M|F|1269649993019|1269700561582|rcs_mgr|"Starting and using background threads during class initialization can result in class initialization cycles and deadlock. *For instance,* the main thread responsible for performing class initialization *may* block waiting for the background thread, which in turn will wait for the main thread to finish class initialization." ... see suggested words in bold...I am also generally unsure about the use of "can" vs. "may" because deadlocks are a "possibility" so perhaps "may" should be used?|

...


...