Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Java][FlightRPC] Java arrow flight server stuck in reader.getDescriptor()

未关闭
#431 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
cpp, java
领域
api

调研方向

从 FlightStream.java:158 开始,这里 getDescriptor() 正在等待,然后沿着 Java 的 doExchange 路径跟踪经过 FlightService 和 UDFProducer.java:266 的流程。将该流程与多线程设置中提供的 jstack 证据以及 C++ 的 Client_->DoExchange(descriptor) 调用进行比较。完成的标准是确定 descriptor future 为什么始终未被设置,并记录一个可复现的原因或已确认的解决方案。

由索引模型根据 Issue 内容生成。

描述

Type: usage
Describe the usage question you have. Please include as many useful details as possible.

Platform: Ubuntu 20.04.6 LTS
Arrow version: 15.
Client: C++
Server: Java
I have a Java arrow flight server that uses doExchange to read the context, my server code is as follows, I have identified in multiple thread environment, in the tests many calls would stuck at the line FlightDescriptor descriptor = reader.getDescriptor(); in the second time(Which means the first call in the same thread usually is not blocked), and which makes the following requests also stucks.

        log.info("Start to call doExchange.........");
        // Trying to
        try (BufferAllocator allocator = allocatorPool.submit(
            () -> this.allocator.newChildAllocator("exchange", 0, Long.MAX_VALUE)).get()) {
            FlightDescriptor descriptor = reader.getDescriptor();
            List<String> path = descriptor.getPath();
            String type = path.get(0);
            String funcSignature = path.get(1);
           ...

The client code is as follows

std::vector<std::shared_ptr<RecordBatch>> UDFClient::Call(
    const std::vector<std::string>& paths,
    std::shared_ptr<RecordBatch>& batch) const {
  // Create a FlightDescriptor using a path
  FlightDescriptor descriptor = FlightDescriptor::Path(paths);
  auto exchange_result = Client_->DoExchange(descriptor);
  if (!exchange_result.ok()) {
    throw std::runtime_error("Do exchange descriptor: "
            + exchange_result.status().ToString());
  }
  auto exchange = std::move(exchange_result.ValueUnsafe());
  ...

I understand reader.getDescriptor(); is a blocking call that will use future to wait the descriptor sent. Since doExchange in the server has been called, I assume the client auto exchange_result = Client_->DoExchange(descriptor); has been received. I can't figure what could make reader.getDescriptor(); stuck, I am reporting this to the community that want to know is this a bug or there is something I did wrong. Thank you

This happened in the multiple threads environment. We also check the lock with jstack that shows SettableFuture<FlightDescriptor> descriptor is the one not set that caused the lock.

"pool-1-thread-16" #31 prio=5 os_prio=0 tid=0x00007f6d34009000 nid=0x3a19 waiting on condition [0x00007f6d253ea000]
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x000000076d596180> (a com.google.common.util.concurrent.SettableFuture)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:563)
        at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:110)
        at org.apache.arrow.flight.FlightStream.getDescriptor(FlightStream.java:158)
        at com.bytedance.dp.udf.UDFProducer.doExchange(UDFProducer.java:266)
        at org.apache.arrow.flight.FlightService.lambda$doExchangeCustom$2(FlightService.java:382)
        at org.apache.arrow.flight.FlightService$$Lambda$65/298187580.run(Unknown Source)
        at io.grpc.Context$1.run(Context.java:566)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        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)
Component(s)

C++, FlightRPC, Java

主要语言
Java
星标
95
派生
154
平均合并
2 天 10 小时
30 天内合并 PR
11

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/arrow-java 的其他 Issue

查看 apache/arrow-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。