Comments (5)
All of those have a remote_addr
property, which means that the call was associated with an active connection to the server with that IP address. The other parts of the extra details show how much time was spent in each step before associating the call with a connection. For example, the first error message shows that it took 1ms in the LB pick step. Values less than 1ms are omitted, so the absence of "LB pick" in the others just means that that step was faster than that.
What this indicates is that all of these requests timed out a full second after the client actually sent the request to the server. That generally indicates server-side latency.
from grpc-node.
The channel can only enter the SHUTDOWN state if the application calls the close()
method. So its presence in that error message only means that you called that request, and then you closed the channel/client, and then the request timed out. That channel-level connectivity state gives no information about the state of the connection the call was made on. In fact, the remote_addr
component in the DEADLINE_EXCEEDED directly indicates that as far as the client knows, the connection was functional.
The unsafety of retrying requests is inherent to the problem. If the client sends a request, as far as it knows, and never gets a response, it has no way of knowing whether or not the server has processed it. The simplest solution there is to make your RPCs themselves safe to retry, generally by making them idempotent.
If you have an alternative mechanism to detect broken connections, feel free to suggest it.
from grpc-node.
The channel can only enter the SHUTDOWN state if the application calls the close() method
That's interesting. We have an IdleConnection wrapper which re-initializes the client every x
minutes or so. That's the only place where we call a close()
. But that code path only triggers for an idle client so a shutdown
shouldn't have impacted any new call as we just dispose off the previous idle channel (added code in Appendix).
This was before the grpc
channel options had this setting pre-vended for max_client_age
; we can switch to that, however I'd expect close()
to gracefully complete existing RPCs on the channel as per this [comment] anyhow (#1211 (comment)):
The close method prevents new calls from being started and frees up resources once all active calls have finished, but it does allow those active calls to finish normally. If you want to cancel active calls you need to explicitly cancel them individually.
So its presence in that error message only means that you called that request, and then you closed the channel/client, and then the request timed out.
Going via the above comment, shouldn't the existing request complete even if I closed the channel?
Appendix - Code where we call close
export class IdleGrpcClientWrapper<T extends CloseableGrpcClient>
implements GrpcClientWrapper<T>
{
private readonly logger: MomentoLogger;
private client: T;
private readonly clientFactoryFn: () => T;
private readonly maxIdleMillis: number;
private lastAccessTime: number;
constructor(props: IdleGrpcClientWrapperProps<T>) {
this.logger = props.loggerFactory.getLogger(this);
this.clientFactoryFn = props.clientFactoryFn;
this.client = this.clientFactoryFn();
this.maxIdleMillis = props.maxIdleMillis;
this.lastAccessTime = Date.now();
}
getClient(): T {
this.logger.trace(
`Checking to see if client has been idle for more than ${this.maxIdleMillis} ms`
);
if (Date.now() - this.lastAccessTime > this.maxIdleMillis) {
this.logger.info(
`Client has been idle for more than ${this.maxIdleMillis} ms; reconnecting.`
);
this.client.close();
this.client = this.clientFactoryFn();
}
this.lastAccessTime = Date.now();
return this.client;
}
}
from grpc-node.
I think you misunderstood. I'm not saying that closing the channel caused the RPC to time out. All I'm saying is that knowing that the channel state was SHUTDOWN at the end of the RPC lifetime gives us no more information than that the channel was closed before the call ended.
from grpc-node.
Thank you @murgatroid99 ! I had one question about some recent observations and if the logs tell something since you added some new context to them. There were 5 consecutive requests that resulted in a deadline:
The first deadline request had a lb_pick
. Does this indicate a DNS resolution happened for this request?
Deadline exceeded after 1.102s,LB pick: 0.001s,remote_addr=3.222.218.75:443
The next two requests didn't have LB pick in the error messages:
Deadline exceeded after 1.101s,remote_addr=3.222.218.75:443
Deadline exceeded after 1.101s,remote_addr=3.222.218.75:443
Then the channel/connection was idle for roughly 1.5 seconds and had two more deadline errors:
Again first with lb_pick
:
Deadline exceeded after 1.102s,LB pick: 0.001s,remote_addr=3.222.218.75:443
This time, the next deadline error had another property metadata_filters
:
Deadline exceeded after 1.103s,metadata filters: 0.001s,remote_addr=3.222.218.75:443
After these 5 requests, subsequent requests were succeeding.
Curious if this indicates something.
from grpc-node.
Related Issues (20)
- RST_STREAM with code 2 / system error -505 when using HTTP CONNECT proxy HOT 6
- it is not up to the expectations after editing `max_connection_xxx` params【in kubernetes】 HOT 4
- Unable to use google.protobuf.Struct with @grpc/grpc-js HOT 1
- Grpc Unary calls not giving any response after client is in idle for some time(30mins) HOT 10
- can we provide a detailed tutorial of grpc-js-xds? HOT 1
- How to capture gRPC keep alives with tcpdump? HOT 2
- not sure why i'm seeing grpc blocking the event loop so often HOT 4
- if the message has an optional field with a return value, the proto will attach a same name field with `_` prefix. why? HOT 2
- TypeError: The "original" argument must be of type Function | @grpc/grpc-js/build/src/resolver-dns.js HOT 3
- Exposing connection error reasons (ie, TLS failures) HOT 3
- Clarify build steps for v10+ HOT 2
- Discussion: Why HTTP2 pseudo headers such as :authory are removed from Metadata HOT 2
- Deadline examples/docs could use clarification HOT 8
- When response stream includes messages and then an error, final message(s) can be dropped HOT 1
- Servers base64-encode “grpc-status-details-bin” header with padding, but should be unpadded HOT 1
- Server does not check the HTTP method of the request HOT 2
- Compression handling has some issues
- Cardinality violations should use error code “unimplemented” HOT 3
- Servers send grpc-message trailer even when no error HOT 1
- successful calls still emit 'cancelled' as of v1.10.x HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpc-node.