apache / apache/pinot

Tracing doesn't work in some multi-server setup

Open
#10,399 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6.1k
Forks
1.5k
Avg merge
2d 55m
Merged PRs (30d)
182

Description

Currently trace info is recorded on a thread-local context with requestID as its primary key.

1. When 2 servers are launched on the same JVM such as quickstart runner, it can collide and cause issue
2. When 2 brokers individually generates requestID long and send to the same server simultaneously it will also cause contention (although very rare)
3. for multi-stage engine, the same could happen much more frequently b/c the same requestID with different stageID can be sent to the same server (addressed in #10390)

log sample
```
java.util.ConcurrentModificationException: null
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1043) ~[?:?]
at java.util.ArrayList$Itr.next(ArrayList.java:997) ~[?:?]
at org.apache.pinot.core.util.trace.TraceContext$Trace.toJson(TraceContext.java:91) ~[classes/:?]
at org.apache.pinot.core.util.trace.TraceContext.getTraceInfo(TraceContext.java:195) ~[classes/:?]
at org.apache.pinot.core.query.executor.ServerQueryExecutorV1Impl.executeInternal(ServerQueryExecutorV1Impl.java:284) ~[classes/:?]
at org.apache.pinot.core.query.executor.ServerQueryExecutorV1Impl.execute(ServerQueryExecutorV1Impl.java:146) ~[classes/:?]
at org.apache.pinot.core.query.executor.QueryExecutor.execute(QueryExecutor.java:100) ~[classes/:?]
at org.apache.pinot.core.query.scheduler.QueryScheduler.processQueryAndSerialize(QueryScheduler.java:154) ~[classes/:?]
at org.apache.pinot.core.query.scheduler.QueryScheduler.lambda$createQueryFutureTask$0(QueryScheduler.java:136) ~[classes/:?]
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java) [?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
```

Contributor guide

Open the contributing guide

Research direction

Start with org.apache.pinot.core.util.trace.TraceContext, especially TraceContext$Trace.toJson and getTraceInfo, then follow how ServerQueryExecutorV1Impl invokes tracing. Reproduce the ConcurrentModificationException with multiple servers or concurrent brokers and inspect the requestID and stageID handling described here. Done means tracing works without collisions or concurrent modification in the listed multi-server scenarios.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.