grpc / grpc/grpc-node

not sure why i'm seeing grpc blocking the event loop so often

Open
#2,753 10 comments 1 reaction 0 assignees View on GitHub
package: @grpc/grpc-js requires reporter action
Dominant language
TypeScript
Stars
4.8k
Forks
716
Avg merge
2d 3h
Merged PRs (30d)
10

Description

### Problem description
i tried to turn on event loop block detection, and all i see are grpc calls (we use google pubsub and other grpc-using tools), which doesn't make sense to me, since i thought during the call the system should yield

### Reproduction steps
Use grpc on a busy server (we use google secrets manager, google pubsub, etc.)

### Environment
- Linux Ubuntu 18.04 amd64
- Node 18
- nvm/yarn

### Additional context

Examples:

```
7: " at /app/node_modules/@grpc/grpc-js/build/src/resolving-call.js:192:22"
8: " at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
message: "Event loop blocked for 600.4265230000019ms, operation started here:"
```

```
"4": " at Subchannel.startConnecting (/app/node_modules/@grpc/grpc-js/build/src/subchannel.js:278:17)",
"5": " at ChannelSubchannelWrapper.startConnecting (/app/node_modules/@grpc/grpc-js/build/src/subchannel-interface.js:34:20)",
"6": " at PickFirstLoadBalancer.exitIdle (/app/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.js:341:24)",
"7": " at ChildLoadBalancerHandler.exitIdle (/app/node_modules/@grpc/grpc-js/build/src/load-balancer-child-handler.js:112:31)",
"8": " at ResolvingLoadBalancer.exitIdle (/app/node_modules/@grpc/grpc-js/build/src/resolving-load-balancer.js:235:32)",
"9": " at InternalChannel.getConfig (/app/node_modules/@grpc/grpc-js/build/src/internal-channel.js:313:36)",
"10": " at ResolvingCall.getConfig (/app/node_modules/@grpc/grpc-js/build/src/resolving-call.js:121:43)",
"11": " at /app/node_modules/@grpc/grpc-js/build/src/internal-channel.js:200:26",
"12": " at process.processTicksAndRejections (node:internal/process/task_queues:77:11)",
"message": "Event loop blocked for 99.32906599998473ms, operation started here:"
```

basically most of my event loop is blocked on grpc stuff. is there some configuration or setting to make it properly yield?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.