Exceptions being thrown on execution with Spring related to gRPC and PerfMark

Running Temporal with Spring generates some exceptions that are not thrown in a standalone Temporal instance.

// App.java 

@ComponentScan
@EnableAutoConfiguration(exclude = {MetricFilterAutoConfiguration.class, MetricRepositoryAutoConfiguration.class})
@EnableConfigurationProperties({LiquibaseProperties.class, ApplicationProperties.class, JHipsterExtraProperties.class})
public class App {
  public static void main(String[] args) {
    SpringApplication app = new SpringApplication(App.class);

    // some calls here ...

    // Init Temporal
    WorkflowServiceStubs service = WorkflowServiceStubs.newInstance();
    WorkflowClient client = WorkflowClient.newInstance(service);
    WorkerFactory factory = WorkerFactory.newInstance(client);

    Worker worker = factory.newWorker("Queue1");
    worker.registerWorkflowImplementationTypes(HelloWorldImpl.class); // workflow calls the activity and returns the result
    worker.registerActivitiesImplementations(new SayHiActivityImpl()); // activity returns "Hello world"

    factory.start();

    HelloWorld workflow = client.newWorkflowStub(HelloWorld.class, WorkflowOptions.newBuilder().setTaskQueue("Queue1").build());

    System.out.println("Workflow result: " + workflow.sayHello()); // prints "Hello World"
  }
}

With this code, several exceptions are generated. However, they do not prevent the workflow and the activity from being correctly executed.


This next exceptions are thrown on line 84, which corresponds to the line WorkflowServiceStubs service = WorkflowServiceStubs.newInstance();

`Epoll is not available` and `Unable to apply census stats`
2020-07-27 09:43:17.509 [main] DEBUG
        i.g.netty.shaded.io.grpc.netty.Utils - Epoll is not available, using Nio. 
java.lang.ExceptionInInitializerError: null
	at io.grpc.netty.shaded.io.netty.channel.epoll.Epoll.<clinit>(Epoll.java:39)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at io.grpc.netty.shaded.io.grpc.netty.Utils.isEpollAvailable(Utils.java:284)
	at io.grpc.netty.shaded.io.grpc.netty.Utils.<clinit>(Utils.java:107)
	at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.<clinit>(NettyChannelBuilder.java:74)
	at io.temporal.internal.grpc.WorkflowServiceStubsImpl.<init>(WorkflowServiceStubsImpl.java:108)
	at io.temporal.serviceclient.WorkflowServiceStubs.newInstance(WorkflowServiceStubs.java:34)
	at my.App.main(App.java:84)
Caused by: java.lang.IllegalStateException: Only supported on Linux
	at io.grpc.netty.shaded.io.netty.channel.epoll.Native.loadNativeLibrary(Native.java:225)
	at io.grpc.netty.shaded.io.netty.channel.epoll.Native.<clinit>(Native.java:58)
	... 9 common frames omitted
2020-07-27 09:43:17.603 [main] DEBUG
        i.g.i.AbstractManagedChannelImplBuilder - Unable to apply census stats 
java.lang.ClassNotFoundException: io.grpc.census.InternalCensusStatsAccessor
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at io.grpc.internal.AbstractManagedChannelImplBuilder.getEffectiveInterceptors(AbstractManagedChannelImplBuilder.java:534)
	at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:517)
	at io.temporal.internal.grpc.WorkflowServiceStubsImpl.<init>(WorkflowServiceStubsImpl.java:119)
	at io.temporal.serviceclient.WorkflowServiceStubs.newInstance(WorkflowServiceStubs.java:34)
	at my.App.main(App.java:84)
2020-07-27 09:43:17.603 [main] DEBUG
        i.g.i.AbstractManagedChannelImplBuilder - Unable to apply census stats 
java.lang.ClassNotFoundException: io.grpc.census.InternalCensusTracingAccessor
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at io.grpc.internal.AbstractManagedChannelImplBuilder.getEffectiveInterceptors(AbstractManagedChannelImplBuilder.java:569)
	at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:517)
	at io.temporal.internal.grpc.WorkflowServiceStubsImpl.<init>(WorkflowServiceStubsImpl.java:119)
	at io.temporal.serviceclient.WorkflowServiceStubs.newInstance(WorkflowServiceStubs.java:34)
	at my.App.main(App.java:84)

And this one is thrown after client.newWorkflowStub is called.

`Error during PerfMark: ClassNotFoundException: io.perfmark.impl.SecretPerfMarkImpl$PerfMarkImpl`, and `grpc.Context - Storage override doesn't exist.`
2020-07-27 09:43:17.992 [Activity Poller taskQueue="Queue1", namespace="default": 3] DEBUG
        io.perfmark.PerfMark - Error during PerfMark.<clinit> 
java.lang.ClassNotFoundException: io.perfmark.impl.SecretPerfMarkImpl$PerfMarkImpl
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at io.perfmark.PerfMark.<clinit>(PerfMark.java:36)
	at io.grpc.internal.ClientCallImpl.<init>(ClientCallImpl.java:109)
	at io.grpc.internal.ManagedChannelImpl$RealChannel.newCall(ManagedChannelImpl.java:890)
	at io.grpc.internal.ServiceConfigInterceptor.interceptCall(ServiceConfigInterceptor.java:137)
	at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
	at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:855)
	at io.grpc.internal.ForwardingManagedChannel.newCall(ForwardingManagedChannel.java:63)
	at io.temporal.internal.grpc.GrpcMetricsInterceptor$MetricsClientCall.<init>(GrpcMetricsInterceptor.java:88)
	at io.temporal.internal.grpc.GrpcMetricsInterceptor.interceptCall(GrpcMetricsInterceptor.java:74)
	at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
	at io.temporal.internal.grpc.GrpcDeadlineInterceptor.interceptCall(GrpcDeadlineInterceptor.java:69)
	at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
	at io.grpc.stub.MetadataUtils$HeaderAttachingClientInterceptor.interceptCall(MetadataUtils.java:74)
	at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
	at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:128)
	at io.temporal.api.workflowservice.v1.WorkflowServiceGrpc$WorkflowServiceBlockingStub.pollActivityTaskQueue(WorkflowServiceGrpc.java:2682)
	at io.temporal.internal.worker.ActivityPollTask.poll(ActivityPollTask.java:95)
	at io.temporal.internal.worker.ActivityPollTask.poll(ActivityPollTask.java:38)
	at io.temporal.internal.worker.Poller$PollExecutionTask.run(Poller.java:273)
	at io.temporal.internal.worker.Poller$PollLoopTask.run(Poller.java:242)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2020-07-27 09:43:18.009 [Activity Poller taskQueue="Queue1", namespace="default": 3] DEBUG
        io.grpc.Context - Storage override doesn't exist. Using default 
java.lang.ClassNotFoundException: io.grpc.override.ContextStorageOverride
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at io.grpc.Context$LazyStorage.createStorage(Context.java:142)
	at io.grpc.Context$LazyStorage.<clinit>(Context.java:131)
	at io.grpc.Context.storage(Context.java:119)
	at io.grpc.Context.current(Context.java:185)
	at io.grpc.internal.ClientCallImpl.<init>(ClientCallImpl.java:118)
	at io.grpc.internal.ManagedChannelImpl$RealChannel.newCall(ManagedChannelImpl.java:890)
	at io.grpc.internal.ServiceConfigInterceptor.interceptCall(ServiceConfigInterceptor.java:137)
	at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
	at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:855)
	at io.grpc.internal.ForwardingManagedChannel.newCall(ForwardingManagedChannel.java:63)
	at io.temporal.internal.grpc.GrpcMetricsInterceptor$MetricsClientCall.<init>(GrpcMetricsInterceptor.java:88)
	at io.temporal.internal.grpc.GrpcMetricsInterceptor.interceptCall(GrpcMetricsInterceptor.java:74)
	at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
	at io.temporal.internal.grpc.GrpcDeadlineInterceptor.interceptCall(GrpcDeadlineInterceptor.java:69)
	at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
	at io.grpc.stub.MetadataUtils$HeaderAttachingClientInterceptor.interceptCall(MetadataUtils.java:74)
	at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
	at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:128)
	at io.temporal.api.workflowservice.v1.WorkflowServiceGrpc$WorkflowServiceBlockingStub.pollActivityTaskQueue(WorkflowServiceGrpc.java:2682)
	at io.temporal.internal.worker.ActivityPollTask.poll(ActivityPollTask.java:95)
	at io.temporal.internal.worker.ActivityPollTask.poll(ActivityPollTask.java:38)
	at io.temporal.internal.worker.Poller$PollExecutionTask.run(Poller.java:273)
	at io.temporal.internal.worker.Poller$PollLoopTask.run(Poller.java:242)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Iā€™m on Windows 10, Temporal v0.2.7.

1 Like

Would you file an issue with specifics against Java SDK repo? It look like there are some Windows/Spring specific issues that should be investigated.

Hi @maxim, you can see the issue at https://github.com/temporalio/java-sdk/issues/162.