Parallel runner & Eclipse?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Parallel runner & Eclipse?

JUnit - User mailing list
Hi,

this may be somewhat out of scope, but I'm posting here anyway since I have tried other relevant places with no replies :)

We have a company-internal JUnit 4 runner that can spawn multiple parallel "workers" to run our JUnit tests in parallel by dividing test classes between the workers (we would have liked to make it public, but company policy, yada yada). It has worked fine for years and gives a large speedup when we run the suite from commandline/ant.
But with more recent versions of Eclipse and Java 8, even single-worker operation eats up nearly the entire CPU and Eclipse seems to spawn up an insane amount of threads to run JUnit tests. So using multiple workers only slows down the runtime from Eclipse since we're basically swapping between the threads.
We have not managed to figure out exactly which version it happened and not sure if the problem existed with Java 7 or not, so I can't say if it is eclipse, java 8 or the eclipse junit plugin that is the bad guy. But since ant can take advantage of the parallelism on the same machine with the same java version, Eclipse seems like the culprit here.

Is there anyone around here that has a clue if e.g. the Eclipse JUnit plugin has changed in a way that would cause this or if it is "base Eclipse" behavior. If anyone has some ideas on a workaround, that would be even better!

BR,
  Chris
Reply | Threaded
Open this post in threaded view
|

Re: Parallel runner & Eclipse?

JUnit - User mailing list
Have you tried using ThreadPoolExecutor to create the threads so you limit the number of threads? I suggest making the thread pool a global, and printing a message to stderr or a log file when the thread pool is created (in case class loader magic makes your global variables no longer global)
Reply | Threaded
Open this post in threaded view
|

Re: Parallel runner & Eclipse?

JUnit - User mailing list
In reply to this post by JUnit - User mailing list
Hi Kevin,

thansk for the reply, but I'm not sure I understand your suggestion. If the thread problem was in our runner, shouldn't it show up when running with ant as well? But anyway, we're already using ThreadPoolExecutor, so we should be fine there.
From what I can tell, it isn't the runner that is spawning Java threads, it seems that Eclipse does that even when we have just one worker, but not when running outside Eclipse.

BR,
  Chris

--------------------------------------------
On Fri, 10/7/16, [hidden email] [junit] <[hidden email]> wrote:

 Subject: [junit] Re: Parallel runner & Eclipse?
 To: [hidden email]
 Date: Friday, October 7, 2016, 10:28 PM
 
 
  
 
 
 
   
 
 
     
       
       
       Have you tried using ThreadPoolExecutor to create
 the threads so you limit the number of threads? I suggest
 making the thread pool a global, and printing a message to
 stderr or a log file when the thread pool is created (in
 case class loader magic makes your global variables no
 longer global)
 
     
     
 
     
     
 
 
 
 #yiv7048399463 #yiv7048399463 --
   #yiv7048399463ygrp-mkp {
 border:1px solid #d8d8d8;font-family:Arial;margin:10px
 0;padding:0 10px;}
 
 #yiv7048399463 #yiv7048399463ygrp-mkp hr {
 border:1px solid #d8d8d8;}
 
 #yiv7048399463 #yiv7048399463ygrp-mkp #yiv7048399463hd {
 color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px
 0;}
 
 #yiv7048399463 #yiv7048399463ygrp-mkp #yiv7048399463ads {
 margin-bottom:10px;}
 
 #yiv7048399463 #yiv7048399463ygrp-mkp .yiv7048399463ad {
 padding:0 0;}
 
 #yiv7048399463 #yiv7048399463ygrp-mkp .yiv7048399463ad p {
 margin:0;}
 
 #yiv7048399463 #yiv7048399463ygrp-mkp .yiv7048399463ad a {
 color:#0000ff;text-decoration:none;}
 #yiv7048399463 #yiv7048399463ygrp-sponsor
 #yiv7048399463ygrp-lc {
 font-family:Arial;}
 
 #yiv7048399463 #yiv7048399463ygrp-sponsor
 #yiv7048399463ygrp-lc #yiv7048399463hd {
 margin:10px
 0px;font-weight:700;font-size:78%;line-height:122%;}
 
 #yiv7048399463 #yiv7048399463ygrp-sponsor
 #yiv7048399463ygrp-lc .yiv7048399463ad {
 margin-bottom:10px;padding:0 0;}
 
 #yiv7048399463 #yiv7048399463actions {
 font-family:Verdana;font-size:11px;padding:10px 0;}
 
 #yiv7048399463 #yiv7048399463activity {
 background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}
 
 #yiv7048399463 #yiv7048399463activity span {
 font-weight:700;}
 
 #yiv7048399463 #yiv7048399463activity span:first-child {
 text-transform:uppercase;}
 
 #yiv7048399463 #yiv7048399463activity span a {
 color:#5085b6;text-decoration:none;}
 
 #yiv7048399463 #yiv7048399463activity span span {
 color:#ff7900;}
 
 #yiv7048399463 #yiv7048399463activity span
 .yiv7048399463underline {
 text-decoration:underline;}
 
 #yiv7048399463 .yiv7048399463attach {
 clear:both;display:table;font-family:Arial;font-size:12px;padding:10px
 0;width:400px;}
 
 #yiv7048399463 .yiv7048399463attach div a {
 text-decoration:none;}
 
 #yiv7048399463 .yiv7048399463attach img {
 border:none;padding-right:5px;}
 
 #yiv7048399463 .yiv7048399463attach label {
 display:block;margin-bottom:5px;}
 
 #yiv7048399463 .yiv7048399463attach label a {
 text-decoration:none;}
 
 #yiv7048399463 blockquote {
 margin:0 0 0 4px;}
 
 #yiv7048399463 .yiv7048399463bold {
 font-family:Arial;font-size:13px;font-weight:700;}
 
 #yiv7048399463 .yiv7048399463bold a {
 text-decoration:none;}
 
 #yiv7048399463 dd.yiv7048399463last p a {
 font-family:Verdana;font-weight:700;}
 
 #yiv7048399463 dd.yiv7048399463last p span {
 margin-right:10px;font-family:Verdana;font-weight:700;}
 
 #yiv7048399463 dd.yiv7048399463last p
 span.yiv7048399463yshortcuts {
 margin-right:0;}
 
 #yiv7048399463 div.yiv7048399463attach-table div div a {
 text-decoration:none;}
 
 #yiv7048399463 div.yiv7048399463attach-table {
 width:400px;}
 
 #yiv7048399463 div.yiv7048399463file-title a, #yiv7048399463
 div.yiv7048399463file-title a:active, #yiv7048399463
 div.yiv7048399463file-title a:hover, #yiv7048399463
 div.yiv7048399463file-title a:visited {
 text-decoration:none;}
 
 #yiv7048399463 div.yiv7048399463photo-title a,
 #yiv7048399463 div.yiv7048399463photo-title a:active,
 #yiv7048399463 div.yiv7048399463photo-title a:hover,
 #yiv7048399463 div.yiv7048399463photo-title a:visited {
 text-decoration:none;}
 
 #yiv7048399463 div#yiv7048399463ygrp-mlmsg
 #yiv7048399463ygrp-msg p a span.yiv7048399463yshortcuts {
 font-family:Verdana;font-size:10px;font-weight:normal;}
 
 #yiv7048399463 .yiv7048399463green {
 color:#628c2a;}
 
 #yiv7048399463 .yiv7048399463MsoNormal {
 margin:0 0 0 0;}
 
 #yiv7048399463 o {
 font-size:0;}
 
 #yiv7048399463 #yiv7048399463photos div {
 float:left;width:72px;}
 
 #yiv7048399463 #yiv7048399463photos div div {
 border:1px solid
 #666666;height:62px;overflow:hidden;width:62px;}
 
 #yiv7048399463 #yiv7048399463photos div label {
 color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}
 
 #yiv7048399463 #yiv7048399463reco-category {
 font-size:77%;}
 
 #yiv7048399463 #yiv7048399463reco-desc {
 font-size:77%;}
 
 #yiv7048399463 .yiv7048399463replbq {
 margin:4px;}
 
 #yiv7048399463 #yiv7048399463ygrp-actbar div a:first-child {
 margin-right:2px;padding-right:5px;}
 
 #yiv7048399463 #yiv7048399463ygrp-mlmsg {
 font-size:13px;font-family:Arial, helvetica, clean,
 sans-serif;}
 
 #yiv7048399463 #yiv7048399463ygrp-mlmsg table {
 font-size:inherit;font:100%;}
 
 #yiv7048399463 #yiv7048399463ygrp-mlmsg select,
 #yiv7048399463 input, #yiv7048399463 textarea {
 font:99% Arial, Helvetica, clean, sans-serif;}
 
 #yiv7048399463 #yiv7048399463ygrp-mlmsg pre, #yiv7048399463
 code {
 font:115% monospace;}
 
 #yiv7048399463 #yiv7048399463ygrp-mlmsg * {
 line-height:1.22em;}
 
 #yiv7048399463 #yiv7048399463ygrp-mlmsg #yiv7048399463logo {
 padding-bottom:10px;}
 
 
 #yiv7048399463 #yiv7048399463ygrp-msg p a {
 font-family:Verdana;}
 
 #yiv7048399463 #yiv7048399463ygrp-msg
 p#yiv7048399463attach-count span {
 color:#1E66AE;font-weight:700;}
 
 #yiv7048399463 #yiv7048399463ygrp-reco
 #yiv7048399463reco-head {
 color:#ff7900;font-weight:700;}
 
 #yiv7048399463 #yiv7048399463ygrp-reco {
 margin-bottom:20px;padding:0px;}
 
 #yiv7048399463 #yiv7048399463ygrp-sponsor #yiv7048399463ov
 li a {
 font-size:130%;text-decoration:none;}
 
 #yiv7048399463 #yiv7048399463ygrp-sponsor #yiv7048399463ov
 li {
 font-size:77%;list-style-type:square;padding:6px 0;}
 
 #yiv7048399463 #yiv7048399463ygrp-sponsor #yiv7048399463ov
 ul {
 margin:0;padding:0 0 0 8px;}
 
 #yiv7048399463 #yiv7048399463ygrp-text {
 font-family:Georgia;}
 
 #yiv7048399463 #yiv7048399463ygrp-text p {
 margin:0 0 1em 0;}
 
 #yiv7048399463 #yiv7048399463ygrp-text tt {
 font-size:120%;}
 
 #yiv7048399463 #yiv7048399463ygrp-vital ul li:last-child {
 border-right:none !important;
 }
 #yiv7048399463
 
Reply | Threaded
Open this post in threaded view
|

Re: Parallel runner & Eclipse?

JUnit - User mailing list
It's hard to suggest more without seeing the code.
 

 Does the problem happen when you run tests in Eclipse that do not use your custom runner? Do you limit the number of threads when you configure the `ThreadPoolExecutor`? Did you try adding the print statements that I suggested?
 

Reply | Threaded
Open this post in threaded view
|

Re: Parallel runner & Eclipse?

JUnit - User mailing list
In reply to this post by JUnit - User mailing list
I don't know why it shows up in Eclipse but not Ant. Does it show up in Eclipse for tests that do not use your custom runner? What is the maximum thread count for your executor? Did you try adding the debugging I suggested or using the Eclipse debugger?
Reply | Threaded
Open this post in threaded view
|

Re: Parallel runner & Eclipse?

JUnit - User mailing list
(sorry for the double-post; it took a while for my first reply to show up so I thought I forgot to submit it)
Reply | Threaded
Open this post in threaded view
|

Re: Parallel runner & Eclipse?

JUnit - User mailing list
In reply to this post by JUnit - User mailing list
Hi,

- We limit the number of threads on the pool.
- I tried with some debug prints as well as some profiling and the number of threads/pools look right
- I get the same behavior without the custom runner

Then your comments got me thinking a bit, so I went back to the investigations we did some time back and I think that I have to update what I said previously. Must have been some confusion on our side when we analyzed it previously.

- Many threads isn't really the problem, it is just one thread that seems to get any significant CPU time. It rather seems that it is "overflowing" to occupy more than one core, which surprises me a bit considering the application under test is completely single-threaded. Tried to reproduce it by making some dummy code, but that stayed at a load of about "one core", so I'm confused to say the least.
- I played around with the garbage collection, but that doesn't change the picture.

So it is probably that I don't understand how the JVM works rather than an issue with junit or Eclipse :)

Thanks for the help.

/Chris

--------------------------------------------
On Sun, 10/9/16, [hidden email] [junit] <[hidden email]> wrote:

 Subject: [junit] Re: Parallel runner & Eclipse?
 To: [hidden email]
 Date: Sunday, October 9, 2016, 6:09 PM
       
       It's hard to suggest more without
 seeing the code.
 Does the problem happen when
 you run tests in Eclipse that do not use your custom runner?
 Do you limit the
 number of threads when you configure the `ThreadPoolExecutor`? Did you try adding the print
 statements that I suggested?
 
         Posted by: [hidden email]