CWE
Home > CWE List > CWE- Individual Dictionary Definition (1.1)  
Search by ID:

CWE-572: Call to Thread run() instead of start()

Individual Definition in a New Window
Call to Thread run() instead of start()
Status: Draft
Weakness ID: 572 (Weakness Variant)
Description
Summary

The program calls a thread's run() method instead of calling start(), which causes the code to run in the thread of the caller instead of the callee.

Affected Resources
* System Process
Potential Mitigations

Use the start() method instead of the run() method.

Demonstrative Examples

The following excerpt from a Java program mistakenly calls run() instead of start().

Thread thr = new Thread() {
public void run() {
...
}
};
 
thr.run();
Other Notes

In most cases a direct call to a Thread object's run() method is a bug. The programmer intended to begin a new thread of control, but accidentally called run() instead of start(), so the run() method will execute in the caller's thread of control.

Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfWeakness BaseWeakness BaseWeakness Base366Race Condition within a Thread
Development Concepts (primary)699
Research Concepts (primary)1000
ChildOfCategoryCategory557Concurrency Issues
Development Concepts699
ChildOfCategoryCategory634Weaknesses that Affect System Processes
Resource-specific Weaknesses (primary)631
Applicable Platforms
Languages
Java
Time of Introduction
* Implementation
Content History
Modifications
Eric Dalci. Cigital. 2008-07-01. (External)
updated Potential_Mitigations, Time_of_Introduction
CWE Content Team. MITRE. 2008-09-08. (Internal)
updated Relationships, Other_Notes
Previous Entry Names
* Call to Thread.run() (changed 2008-04-11)
Page Last Updated: November 24, 2008