Emma "address already in use" error on TeamCity

I am having a problem trying to use the emma coverage support in TeamCity 6.5.4. We have two different ant builds - one that runs the actual compiles, and another that runs our regression tests. However, there seems to be no way to tell TeamCity that this is the case for emma. When I modify the project to say that I want the ant runner to include emma coverage, it insists on trying to actually instrument every run of Java code that is done by the compile build. This includes things that I clearly don't need coverage for, such as the <apt> task.

I've worked around the missing class errors by adding emma.jar to the classpaths for all the tasks that end up running java code. However, now I'm having a problem where I see an "address already in use" error on the thrid invocation of the apt task. I have tried everything I know to get this to go away. I found one reference to a problem someone had back in TeamCity 2 where a Java process that emma was tracing failed with a JNI error, and that caused the process to hang around tying up the address that emma uses, but I can't see anything other than the warnings that apt usually generates for our cdoe. Do I really have to resolve every apt-generated warning in order to get emma to work here? I don't even know how to resolve the complaints it's making now (for example, "warning: Using default delegate interface name for bean com.lombardisoftware.server.ejb.commonservices.PerfCommonServicesCore : com.lombardisoftware.client.delegate.PerfCommonServicesDelegate" - what am I supposed to do with this? There's no file name or line number to look at).

In any case, what I really want is for our compile build to only add instrumentation to the classes, and for our test build (which I naven't even gotten to) to just run and gather instrumentation data. There's no need for emma coverage on apt and other utilities that run during our compile phase. Is there any way to do this?

Here are the log sections from each apt run. The error is in red and bold.

First:

[13:19:01]: [compile_client] Adding debug=true parameter to javac task
[13:19:01]: [compile_client] apt (32s)
[13:19:01]: [apt] Ignoring compiler attribute for the APT task, as it is fixed
[13:19:01]: [apt] Since compiler setting isn't classic or modern,ignoring fork setting.
[13:19:01]: [compile_client] Compiling 558 source files to /opt/TeamCity/BuildAgent/work/fd4441ffbbf1320b/build2/server-core/classes-clnt
[13:19:01]: [compile_client] Warning: Reference websphere.core.classpath has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may support  referencing ids defined in non-executed targets.
[13:19:01]: [compile_client] Warning: Reference emma.lib has not been set at runtime, but was found during build file parsing, attempting to resolve. Future versions of Ant may support  referencing ids defined in non-executed targets.
[13:19:01]: [apt] Since compiler setting isn't classic or modern,ignoring fork setting.
[13:19:14]: [compile_client] EMMA: collecting runtime coverage data ...
[13:19:15]: [compile_client] EMMA: runtime controller started on port [47653]
[13:19:15]: [apt] warning: Annotation types without processors: [java.lang.SuppressWarnings, java.lang.annotation.Target, java.lang.annotation.Retention, com.lombardi.annotation.NonUIThread, java.lang.Override, com.lombardi.annotation.serialization.Persisted, java.lang.Deprecated]
[13:19:19]: [apt] 1 warning
[13:19:34]: [apt] Note: Some input files use or override a deprecated API.
[13:19:34]: [apt] Note: Recompile with -Xlint:deprecation for details.
[13:19:34]: [apt] Note: Some input files use unchecked or unsafe operations.
[13:19:34]: [apt] Note: Recompile with -Xlint:unchecked for details.
[13:19:34]: [compile_client] EMMA: locking coverage output file [/opt/TeamCity/BuildAgent/work/fd4441ffbbf1320b/wle/modules/server-core/coverage.ec] ...
[13:19:34]: [compile_client] EMMA: runtime coverage data merged into [/opt/TeamCity/BuildAgent/work/fd4441ffbbf1320b/wle/modules/server-core/coverage.ec] {in 38 ms}
[13:19:34]: [compile_client] EMMA: Instrumenting classes
[13:19:34]: [EMMA: Instrumenting classes] EMMA commandline: [-ix, -*Test*, -cp, /opt/TeamCity/BuildAgent/work/fd4441ffbbf1320b/build2/server-core/classes-clnt, -m, overwrite]
[13:19:34]: [EMMA: Instrumenting classes] EMMA: processing instrumentation path ...
[13:19:35]: [EMMA: Instrumenting classes] EMMA: instrumentation path processed in 759 ms
[13:19:35]: [EMMA: Instrumenting classes] EMMA: [886 class(es) instrumented, 0 resource(s) copied]
[13:19:35]: [EMMA: Instrumenting classes] EMMA: metadata merged into [/opt/TeamCity/BuildAgent/work/fd4441ffbbf1320b/coverage.em] {in 40 ms}

Second:
[13:19:56]: [ant] compile_server (13s)
[13:19:56]: [compile_server] Adding debug=true parameter to javac task
[13:19:56]: [compile_server] apt (13s)
[13:19:56]: [apt] Ignoring compiler attribute for the APT task, as it is fixed
[13:19:56]: [apt] Since compiler setting isn't classic or modern,ignoring fork setting.
[13:19:56]: [compile_server] Compiling 84 source files to /opt/TeamCity/BuildAgent/work/fd4441ffbbf1320b/build2/server-core/classes-svr
[13:19:56]: [apt] Since compiler setting isn't classic or modern,ignoring fork setting.
[13:20:03]: [compile_server] EMMA: collecting runtime coverage data ...
[13:20:03]: [compile_server] EMMA: runtime controller started on port [47653]
[13:20:03]: [apt] warning: Annotation types without processors: [java.lang.Override, java.lang.Deprecated, com.lombardisoftware.utility.spring.TransactionType, com.lombardisoftware.utility.api.PublicAPI, java.lang.annotation.Target, java.lang.annotation.Retention, java.lang.annotation.Inherited, java.lang.annotation.Documented]
[13:20:04]: [apt] warning: Using default delegate interface name for bean com.lombardisoftware.server.ejb.commonservices.PerfCommonServicesCore : com.lombardisoftware.client.delegate.PerfCommonServicesDelegate
[13:20:04]: [apt] warning: Using default delegate interface name for bean com.lombardisoftware.server.ejb.commonservices.CommonServicesCore : com.lombardisoftware.client.delegate.CommonServicesDelegate
[13:20:04]: [apt] warning: Using default delegate interface name for bean com.lombardisoftware.server.ejb.pk.PKGeneratorCore : com.lombardisoftware.client.delegate.PKGeneratorDelegate
[13:20:04]: [apt] warning: Using default delegate interface name for bean com.lombardisoftware.server.ejb.persistence.PerfPersistenceServicesCore : com.lombardisoftware.client.delegate.PerfPersistenceServicesDelegate
[13:20:04]: [apt] warning: Using default delegate interface name for bean com.lombardisoftware.server.ejb.pk.PerfPKGeneratorCore : com.lombardisoftware.client.delegate.PerfPKGeneratorDelegate
[13:20:04]: [apt] warning: Using default delegate interface name for bean com.lombardisoftware.server.ejb.persistence.PersistenceServicesCore : com.lombardisoftware.client.delegate.PersistenceServicesDelegate
[13:20:04]: [apt] Note: Some input files use or override a deprecated API.
[13:20:04]: [apt] Note: Recompile with -Xlint:deprecation for details.
[13:20:04]: [apt] 7 warnings
[13:20:05]: [apt] Note: Some input files use or override a deprecated API.
[13:20:05]: [apt] Note: Recompile with -Xlint:deprecation for details.
[13:20:10]: [apt] Note: Some input files use or override a deprecated API.
[13:20:10]: [apt] Note: Recompile with -Xlint:deprecation for details.
[13:20:10]: [apt] Note: Some input files use unchecked or unsafe operations.
[13:20:10]: [apt] Note: Recompile with -Xlint:unchecked for details.
[13:20:10]: [compile_server] EMMA: locking coverage output file [/opt/TeamCity/BuildAgent/work/fd4441ffbbf1320b/wle/modules/server-core/coverage.ec] ...
[13:20:10]: [compile_server] EMMA: runtime coverage data merged into [/opt/TeamCity/BuildAgent/work/fd4441ffbbf1320b/wle/modules/server-core/coverage.ec] {in 82 ms}
[13:20:10]: [compile_server] EMMA: Instrumenting classes
[13:20:10]: [EMMA: Instrumenting classes] EMMA commandline: [-ix, -*Test*, -cp, /opt/TeamCity/BuildAgent/work/fd4441ffbbf1320b/build2/server-core/classes-svr, -m, overwrite]
[13:20:10]: [EMMA: Instrumenting classes] EMMA: processing instrumentation path ...
[13:20:10]: [EMMA: Instrumenting classes] EMMA: instrumentation path processed in 117 ms
[13:20:10]: [EMMA: Instrumenting classes] EMMA: [234 class(es) instrumented, 0 resource(s) copied]
[13:20:10]: [EMMA: Instrumenting classes] EMMA: metadata merged into [/opt/TeamCity/BuildAgent/work/fd4441ffbbf1320b/coverage.em] {in 14 ms}


Third:
[13:20:49]: [apt] Ignoring compiler attribute for the APT task, as it is fixed
[13:20:49]: [apt] Since compiler setting isn't classic or modern,ignoring fork setting.
[13:20:49]: [compile-clnt] Compiling 132 source files to /opt/TeamCity/BuildAgent/work/fd4441ffbbf1320b/build2/performance-data-warehouse/classes-clnt
[13:20:49]: [apt] Since compiler setting isn't classic or modern,ignoring fork setting.
[13:20:55]: [compile-clnt] EMMA: collecting runtime coverage data ...
[13:20:55]: [apt] java.net.BindException: Address already in use
[13:20:55]: [apt] at java.net.PlainSocketImpl.socketBind(Native Method)
[13:20:55]: [apt] at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:415)
[13:20:55]: [apt] at java.net.ServerSocket.bind(ServerSocket.java:330)
[13:20:55]: [apt] at java.net.ServerSocket.<init>(ServerSocket.java:196)
[13:20:55]: [apt] at java.net.ServerSocket.<init>(ServerSocket.java:108)
[13:20:55]: [apt] at com.vladium.emma.rt.RTController.start(RTController.java:99)
[13:20:55]: [apt] at com.vladium.emma.rt.RT.reset(RT.java:222)
[13:20:55]: [apt] at com.vladium.emma.rt.RT.<clinit>(RT.java:540)
[13:20:55]: [apt] at java.lang.J9VMInternals.initializeImpl(Native Method)
[13:20:55]: [apt] at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
[13:20:55]: [apt] at com.lombardisoftware.codegen.apt.DelegateAnnotationProcessorFactory.$VRi(DelegateAnnotationProcessorFactory.java)
[13:20:55]: [apt] at com.lombardisoftware.codegen.apt.DelegateAnnotationProcessorFactory.<clinit>(DelegateAnnotationProcessorFactory.java)
[13:20:55]: [apt] at java.lang.J9VMInternals.initializeImpl(Native Method)
[13:20:55]: [apt] at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
[13:20:55]: [apt] at java.lang.J9VMInternals.newInstanceImpl(Native Method)
[13:20:55]: [apt] at java.lang.Class.newInstance(Class.java:1345)
[13:20:55]: [apt] at com.sun.tools.apt.comp.Apt.main(Apt.java:299)
[13:20:55]: [apt] at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:270)
[13:20:55]: [apt] at com.sun.tools.apt.main.Main.compile(Main.java:1114)
[13:20:55]: [apt] at com.sun.tools.apt.main.Main.compile(Main.java:976)
[13:20:55]: [apt] at com.sun.tools.apt.Main.processing(Main.java:107)
[13:20:55]: [apt] at com.sun.tools.apt.Main.process(Main.java:55)
[13:20:55]: [apt] at com.sun.tools.apt.Main.main(Main.java:46)
[13:20:55]: [apt] Problem encountered during annotation processing;
[13:20:55]: [apt] see stacktrace below for more information.
[13:20:55]: [apt] java.lang.Error: EMMA: runtime controller could not be started, aborting
[13:20:55]: [apt] at com.vladium.emma.rt.RT.reset(RT.java:233)
[13:20:55]: [apt] at com.vladium.emma.rt.RT.<clinit>(RT.java:540)
[13:20:55]: [apt] at java.lang.J9VMInternals.initializeImpl(Native Method)
[13:20:55]: [apt] at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
[13:20:55]: [apt] at com.lombardisoftware.codegen.apt.DelegateAnnotationProcessorFactory.$VRi(DelegateAnnotationProcessorFactory.java)
[13:20:55]: [apt] at com.lombardisoftware.codegen.apt.DelegateAnnotationProcessorFactory.<clinit>(DelegateAnnotationProcessorFactory.java)
[13:20:55]: [apt] at java.lang.J9VMInternals.initializeImpl(Native Method)
[13:20:55]: [apt] at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
[13:20:55]: [apt] at java.lang.J9VMInternals.newInstanceImpl(Native Method)
[13:20:55]: [apt] at java.lang.Class.newInstance(Class.java:1345)
[13:20:55]: [apt] at com.sun.tools.apt.comp.Apt.main(Apt.java:299)
[13:20:55]: [apt] at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:270)
[13:20:55]: [apt] at com.sun.tools.apt.main.Main.compile(Main.java:1114)
[13:20:55]: [apt] at com.sun.tools.apt.main.Main.compile(Main.java:976)
[13:20:55]: [apt] at com.sun.tools.apt.Main.processing(Main.java:107)
[13:20:55]: [apt] at com.sun.tools.apt.Main.process(Main.java:55)
[13:20:55]: [apt] at com.sun.tools.apt.Main.main(Main.java:46)

Please sign in to leave a comment.