opencensus-java icon indicating copy to clipboard operation
opencensus-java copied to clipboard

StackdriverTraceExporter java.lang.IllegalAccessError

Open maduris opened this issue 6 years ago • 3 comments

Please answer these questions before submitting a bug report.

What version of OpenCensus are you using?

0.24.0

What JVM are you using (java -version)?

1.8

What did you do?

If possible, provide a recipe for reproducing the error. I am using the following libraries to use stackdriver exporter with opencensus traces <groupId>io.opencensus</groupId> <artifactId>opencensus-api</artifactId> 0.24.0 <groupId>io.opencensus</groupId> <artifactId>opencensus-exporter-trace-stackdriver</artifactId> 0.24.0 <groupId>io.opencensus</groupId> <artifactId>opencensus-impl</artifactId> 0.24.0 runtime Initialising a Tracer with Exporter as:

public Tracer build() 
{
      try {

          StackdriverTraceExporter.createAndRegister(
                  StackdriverTraceConfiguration.builder().build());

      } catch (Exception e) {

          LOGGER.error("Error: Cannot connect to cloud trace, {}", e);

      }

      TraceConfig traceConfig = Tracing.getTraceConfig();
      traceConfig.updateActiveTraceParams(traceConfig.getActiveTraceParams().toBuilder().setSampler(Samplers.alwaysSample()).build());

      return Tracing.getTracer();

    }

After creating spans calling the exporter using:

Tracing.getExportComponent().shutdown();

What did you expect to see?

Traces exported to stackdriver

What did you see instead?

Jan 25, 2020 11:07:58 AM io.opencensus.implcore.trace.export.SpanExporterImpl$Worker onBatchExport WARNING: Exception thrown by the service export io.opencensus.exporter.trace.stackdriver.StackdriverTraceExporter java.lang.IllegalAccessError: tried to access field io.opencensus.trace.unsafe.ContextUtils.CONTEXT_SPAN_KEY from class io.grpc.internal.CensusTracingModule$TracingClientInterceptor at io.grpc.internal.CensusTracingModule$TracingClientInterceptor.interceptCall(CensusTracingModule.java:384) at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156) at io.grpc.internal.CensusStatsModule$StatsClientInterceptor.interceptCall(CensusStatsModule.java:685) at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156) at com.google.api.gax.grpc.GrpcHeaderInterceptor.interceptCall(GrpcHeaderInterceptor.java:81) at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156) at com.google.api.gax.grpc.GrpcMetadataHandlerInterceptor.interceptCall(GrpcMetadataHandlerInterceptor.java:55) at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156) at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:766) at io.grpc.internal.ForwardingManagedChannel.newCall(ForwardingManagedChannel.java:63) at com.google.api.gax.grpc.GrpcClientCalls.newCall(GrpcClientCalls.java:88) at com.google.api.gax.grpc.GrpcDirectCallable.futureCall(GrpcDirectCallable.java:58) at com.google.api.gax.grpc.GrpcUnaryRequestParamCallable.futureCall(GrpcUnaryRequestParamCallable.java:65) at com.google.api.gax.grpc.GrpcExceptionCallable.futureCall(GrpcExceptionCallable.java:64) at com.google.api.gax.tracing.TracedUnaryCallable.futureCall(TracedUnaryCallable.java:75) at com.google.api.gax.rpc.UnaryCallable$1.futureCall(UnaryCallable.java:126) at com.google.api.gax.rpc.UnaryCallable.futureCall(UnaryCallable.java:87) at com.google.api.gax.rpc.UnaryCallable.call(UnaryCallable.java:112) at com.google.cloud.trace.v2.TraceServiceClient.batchWriteSpans(TraceServiceClient.java:234) at com.google.cloud.trace.v2.TraceServiceClient.batchWriteSpans(TraceServiceClient.java:182) at io.opencensus.exporter.trace.stackdriver.StackdriverV2ExporterHandler.export(StackdriverV2ExporterHandler.java:444) at io.opencensus.implcore.trace.export.SpanExporterImpl$Worker.onBatchExport(SpanExporterImpl.java:248) at io.opencensus.implcore.trace.export.SpanExporterImpl$Worker.exportBatches(SpanExporterImpl.java:336) at io.opencensus.implcore.trace.export.SpanExporterImpl$Worker.run(SpanExporterImpl.java:290) at java.lang.Thread.run(Thread.java:748)

Additional context

In version 0.20.0 the same lines of code are able to export traces to stackdriver.

maduris avatar Jan 25 '20 00:01 maduris

I've also encountered similar exception(when using https://github.com/census-ecosystem/opencensus-scala).

I've pulled master of opencensus-java(precisely from this commit: https://github.com/census-instrumentation/opencensus-java/commit/49bac5037cadd5f50227ee87fe86d81043a1170a), built it locally, and used this version as my dependency. This resolved error.

If I had to guess, I would tell that this commit might be relevant in this case: https://github.com/census-instrumentation/opencensus-java/commit/61a025e31d6fccb5168dba161c70b4fd3b94b262

mflis avatar Feb 07 '20 14:02 mflis

We are also seeing these exceptions in our production environment

rajivml avatar May 24 '20 06:05 rajivml

Same here, failing with 0.24.0 and 0.26.0 but passed with 0.23.0

shobhitsharma11 avatar May 26 '20 16:05 shobhitsharma11