We're updating the issue view to help you get more done. 

JBoss4Deployer triggers inifinite loop in SimpleHttpServer, consumes 100%CPU


The invoke remotely method starts the fileserver then does its thing and finaly calls stop on the fileserver.

the fileserver start method creates a new thread with self and starts the thread. the thread invokes run, which invokes runAndThrow.
runAndThrow reads (pseudo code):

1 2 3 4 5 6 7 8 9 while(true){ try{ socket.accept() }catch{SocketException){ // doNothing }finally{ close socket if not null } }//endwhile

now the stop() method does:

1 2 stopped=true; socket.close()

after a socket is closed, it will throw a SocketException for threads blocked in accept() (including a thread which reenters accept()),so the file server goes like this:

1 2 3 4 5 6 7 8 9 while(true){ try{ throw new SocketException(); }catch(SocketException s){ //donothing }finally{ close socket } }//endwhile

Possible fix: while(not this.stopped)

this bug makes my jenkins instance use 50% cpu after 1 deploy, 100% after 2



Savas Ali Tokmen


Jean Helou


Fix versions

Affects versions