|
From: Jing Xu <rob...@gm...> - 2013-08-23 23:43:24
|
Hi everyone,
I am developing a software testing tool to detect thread stress
vulnerability of server application. And our tool detects the vulnerability
on ejbca in following function in
java.org.ejbca.util.PerformanceTest.TestInstance:
public void run(){
PerformanceTest.this.log.info <http://performancetest.this.log.info/>("Thread
nr " + this.nr + " started.");
while (true) {
try {
final long startTime=new Date().getTime();
Command failingCommand=null;
for (int i=0; failingCommand == null && i < this.commands.length;
i++) {
if (this.maxWaitTime > 0) {
final int waitTime=(int)(this.maxWaitTime *
PerformanceTest.this.random.nextFloat());
if (waitTime > 0) {
synchronized (this) {
wait(waitTime);
}
this.statistic.addTime("Time waiting between jobs",waitTime);
}
}
final Command command=this.commands[i];
final JobRunner jobRunner=new JobRunner(command);
if (!jobRunner.execute()) {
failingCommand=command;
}
this.statistic.addTime(command.getJobTimeDescription(),jobRunner.getTimeConsumed());
}
String sResult="Test in thread " + this.nr + " completed ";
if (failingCommand == null) {
this.statistic.taskFinished();
sResult+="successfully";
}
else {
this.statistic.taskFailed();
sResult+="but failed when the command '" +
failingCommand.getClass().getCanonicalName() + "' was executed";
}
sResult+=". The time it took was " + (new Date().getTime() -
startTime) + " ms.";
if (failingCommand == null) {
PerformanceTest.this.log.info<http://performancetest.this.log.info/>
(sResult);
}
else {
PerformanceTest.this.log.error(sResult);
}
}
catch ( Throwable t) {
this.statistic.taskFailed();
PerformanceTest.this.log.error("Exeption in thread " + this.nr +
".",t);
}
}
}
Is it possible that jobRunner.execute() will create unbounded number of
threads? Thanks advanced for your help.
Best,
Jing
|