dthswrp84966 2019-06-14 07:46
浏览 1921

设置了gRPC截止日期,并且呼叫超时差异低于截止时间

I am making gRPC calls from a java service, and using withDeadlineAfter(1000, TimeUnit.MILLISECONDS).callApi()

This call times out in most cases (DEADLINE_EXCEEDED). When I checked the logs, it looks as follows

2019-06-14 06:30:09.153 +0000 - [DEBUG] - from io.grpc.internal.ClientCallImpl - Call timeout set to '999861860' ns, due to context deadline. Explicit call timeout was not set.
2019-06-14 06:30:09.909 +0000 - [ERROR] - from application - [ epoch=1560493809909 req=1560493808679.df7ns.10.0.3.96 ] - EVENT_MIGRATION:Failed to create channel: io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 999695013ns

If I understand correctly, deadline was set at time 06:30:09.153 for the 1 second after 09.153, effectively meaning that the call with the stub should fail after 10.153. The Exception was thrown way before this registered time.

Can someone please explain the behavior?

  • 写回答

2条回答 默认 最新

  • douwen5833 2019-06-24 20:32
    关注

    I'd expect the issue is that the log time was measured from a different point than the deadline time. Namely, the "ns"s were calculated before the logger retrieved the current time.

    This would be particularly noticeably with a new Java process because class loading and Java's slow interpreter mean you can see substantial periods of time between code you'd expect to be fast. It'd also be possible if the system was thrashing due to swap or a high load average.

    评论

报告相同问题?

悬赏问题

  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services