Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Error in distributed environment for clover

Abhinav Sahu April 22, 2014

Hi,

I am getting below error when running my application with clover enabled for distributed setup:

2014-04-22 08:19:14,295 [pool-1-thread-4] INFO itframework.util.CommandRunner - Error Log: ERROR: Error starting recorder service: name=clover.tcp.server;host=localhost;port=1234;timeout=1000;numClients=0;retryPeriod=1000

2014-04-22 08:19:14,295 [pool-1-thread-4] INFO

Although at start I get:

2014-04-22 08:19:14,295 [pool-1-thread-4] INFO itframework.util.CommandRunner - Success Log: Distributed coverage is enabled with: name=clover.tcp.server;host=localhost;port=1234;timeout=1000;numClients=0;retryPeriod=1000
Starting distributed coverage service.

My host is localhost itself and connection is being done through message queue.

Thanks,

Abhinav Sahu

1 answer

1 accepted

0 votes
Answer accepted
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 22, 2014

Hi Abhinav,

The most probably you're trying to start several "Clover Servers" using the same port.

Please check:

  • Are you running tests in parallel? If yes, then make sure that each process/thread will use different port. If not:

  • Are you setting the "-Dclover.server=true" for the JVM process which runs unit tests and not the process which runs application logic? It's easy to confuse the "Clover Server" term with an "appliacation server" one (*). If it's set correctly:

  • Run your tests with debug logging (-Dclover.logging.level=debug for junit task). You will see a full stack trace for the "Error starting recorder service:" message.

Cheers
Marek

(*) See diagram on: https://confluence.atlassian.com/display/CLOVER/Using+Clover+for+web+applications#UsingCloverforwebapplications-WebApp

Abhinav Sahu April 22, 2014

Hi Marek, Thanks for responses.

Product has three components, one can be said as client and other two are servers. They all communicate through a message queue (MQ).

I have built the pkgs enabling clover through an ant task, like:

<clover-setup flushpolicy="interval" flushinterval="1000" initString="/home/ta230208/coverage.db">

<distributedCoverage host="localhost" port="1234" numClients="0" timeout="1000"/>

<fileset dir="${java.src.dir}">

<patternset refid="clover.java.src" />

</fileset>

<testsources dir="${java.test.dir}" />

</clover-setup>

All three components are build in same way and then installed on a machine (localhost).

Yes I am running tests in parallel means client jar is executed through 5 tests. Can I build client pkg with some other option so that it takes different ports everytime? All componenets have seperate build files.

I am enabling "-Dclover.server=true" option when running test case through client jar.

In the meantime I will try to debug using "-Dclover.logging.level=debug" option but please let me know from above if I did anything wrong.

Thanks again,

Abhinav

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 22, 2014

It's possible to override settings from <distributedCoverage> tag at runtime.

You can use the clover.distributed.coverage runtime property which can either take a simple "ON" value or a list of properties, for example:

-Dclover.distributed.coverage=host=localhost;port=7777

See the "Enabling Distributed Coverage at Runtime" chapter on CLOVER/Using+Distributed+Per-test+Coverage+with+Clover-for-Ant page for more details.

It means that in your project you could launch each test with a different value of clover.distributed.coverage.

Abhinav Sahu April 22, 2014

Okay. No I can not change the jar for each tests. Every test calls a batchfile which has following entries:

java -Dclover.server=true -Dlog4j.configuration="file:$DATAMOVER_ROOT/commandline.properties" -jar $DATAMOVER_ROOT/DMCommandLine.jar

Thanks,

Abhinav

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 22, 2014

Yes. This batch a good place to add -Dclover.distributed.coverage.

Abhinav Sahu April 22, 2014

Hi Marek,

I meant to say that If I make change to this file then all tests will connect to that port only as each tests call this file. There is no way I can make each tests takes different port.

Can I make num_clients to 5 as I am running 5 tests at a time?

One more thing these tests are not junit tests they are kind of black box tests.

Thanks again.

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 22, 2014

There is no way I can make each tests takes different port.

Are you sure? You can pass the port number as an environment variable or as a call argument of this batch file.

Can I make num_clients to 5 as I am running 5 tests at a time?

Don't do it. The num_clients is not about number of tests running. It's about a number of JVMs running application logic, which have to connect to the 'Clover Server' before test execution starts.

One more thing these tests are not junit tests they are kind of black box tests.

This is fine. Although (the most probably) you won't see per-test coverage in such case.

Abhinav Sahu April 23, 2014

Hi Marek,

I run tests through a framework so its not possible to pass port number. When enabling debug option, I get:

INFO itframework.util.CommandRunner - Error Log: ERROR: Error starting recorder service: name=clover.tcp.server;host=localhost;port=1234;timeout=1000;numClients=0;retryPeriod=1000Error starting recorder service: name=clover.tcp.server;host=localhost;port=1234;timeout=1000;numClients=0;retryPeriod=1000 : Port already in use: 1234; nested exception is:

java.net.BindException: Address already in use

java.rmi.server.ExportException: Port already in use: 1234; nested exception is:

java.net.BindException: Address already in use

at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:310)

at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:218)

at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:393)

at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:129)

at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:188)

at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:100)

at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:76)

at java.rmi.registry.LocateRegistry.createRegistry(LocateRegistry.java:222)

at clover.gnu.cajo.utils.ItemServer.bind(Unknown Source)

at com.cenqua.clover.remote.CajoTcpRecorderService.start(CajoTcpRecorderService.java:40)

at com.cenqua.clover.remote.DistributedClover.initServer(DistributedClover.java:73)

at com.cenqua.clover.remote.DistributedClover.initClientServer(DistributedClover.java:44)

at com_cenqua_clover.Clover$InitialisedRuntime$1.run(Clover.java:453)

at com_cenqua_clover.Clover$InitialisedRuntime$1.run(Clover.java:430)

at java.security.AccessController.doPrivileged(Native Method)

at com_cenqua_clover.Clover$InitialisedRuntime.getRecorder(Clover.java:430)

at com_cenqua_clover.Clover.getRecorder(Clover.java:122)

:

Can I use Flush policy as Threaded instead of Interval As each my test creates a new thread and run parallely?

Thanks

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 24, 2014

When enabling debug option, I get: ...

The stack trace confirms what I wrote before: "Port already in use: 1234".

Can I use Flush policy as Threaded instead of Interval As each my test creates a new thread and run parallely?

It will not change anything in your case. You must either use a different port numer for each test or run tests sequentially.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events