Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Akka NoSuchElementException in RouteConcatenation$RouteWithConcatenation #13049

Open
Matzz opened this issue Jan 15, 2025 · 2 comments
Open

Akka NoSuchElementException in RouteConcatenation$RouteWithConcatenation #13049

Matzz opened this issue Jan 15, 2025 · 2 comments
Labels
bug Something isn't working needs author feedback Waiting for additional feedback from the author stale

Comments

@Matzz
Copy link

Matzz commented Jan 15, 2025

Hi,
I'm getting following error when using akka + tapir integration:

[otel.javaagent 2025-01-03 16:36:51:073 +0000] [xyz-akka.actor.default-dispatcher-28] DEBUG io.opentelemetry.javaagent.bootstrap.ExceptionLogger - Failed to handle exception in instrumentation for akka.http.scaladsl.server.RouteConcatenation$RouteWithConcatenation
java.util.NoSuchElementException
	at java.base/java.util.ArrayDeque.removeFirst(Unknown Source)
	at java.base/java.util.ArrayDeque.pop(Unknown Source)
	at io.opentelemetry.javaagent.instrumentation.akkahttp.server.route.AkkaRouteHolder.restore(AkkaRouteHolder.java:68)
	at akka.http.scaladsl.server.RouteConcatenation$RouteWithConcatenation.$anonfun$$tilde$1(RouteConcatenation.scala:44)
	at akka.http.scaladsl.server.RouteConcatenation$RouteWithConcatenation.$anonfun$$tilde$2(RouteConcatenation.scala:47)
	at akka.http.scaladsl.util.FastFuture$.strictTransform$1(FastFuture.scala:40)
	at akka.http.scaladsl.util.FastFuture$.$anonfun$transformWith$3(FastFuture.scala:50)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:484)
	at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:64)
	at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:101)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:94)
	at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:101)
	at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:49)
	at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)

As a result traces are recorded only with http method without path.

For the same endpoint defined without tapir it works fine.
tapir version 1.11.12
akka version 2.8.5

Tapir endpoint definition looks more or less like that:

  val definition =
    baseEndpoint.get
      .in("catalog" / "api" / "v1" / "actions")
      .in(QueryParams.actionIdOpt)
      .mapInTo[ActionEnpointInput]
      .out(statusCode.and(jsonBody[Seq[ActionMessage]]))

Steps to reproduce

Create scala application with tapir + akka http server. Instrument it with otel agent. Set OTEL_JAVAAGENT_DEBUG=true.

Expected behavior

OTEL will record span with http method and path.

Actual behavior

As a span name I get only method name without path.

Javaagent or library instrumentation version

2.11.0

Environment

JDK: AdoptOpenJDK OpenJDK 64-Bit Server VM 11.0.7+10
OS: Linux 5.10.230-223.885.amzn2.x86_64

Additional context

No response

@Matzz Matzz added bug Something isn't working needs triage New issue that requires triage labels Jan 15, 2025
@laurit
Copy link
Contributor

laurit commented Jan 16, 2025

Could you provide a minimal application that reproduces the issue along with any necessary instructions.

@steverao steverao added needs author feedback Waiting for additional feedback from the author and removed needs triage New issue that requires triage labels Jan 18, 2025
Copy link
Contributor

This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed automatically if there is no response from the author within 7 additional days from this comment.

@github-actions github-actions bot added the stale label Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs author feedback Waiting for additional feedback from the author stale
Projects
None yet
Development

No branches or pull requests

3 participants