Mercurial > hg > nginx-quic
annotate src/os/unix/ngx_setaffinity.c @ 7892:2096b21fcd10
gRPC: RST_STREAM(NO_ERROR) handling (ticket #1792).
As per https://tools.ietf.org/html/rfc7540#section-8.1,
: A server can send a complete response prior to the client
: sending an entire request if the response does not depend on
: any portion of the request that has not been sent and
: received. When this is true, a server MAY request that the
: client abort transmission of a request without error by
: sending a RST_STREAM with an error code of NO_ERROR after
: sending a complete response (i.e., a frame with the
: END_STREAM flag). Clients MUST NOT discard responses as a
: result of receiving such a RST_STREAM, though clients can
: always discard responses at their discretion for other
: reasons.
Previously, RST_STREAM(NO_ERROR) received from upstream after
a frame with the END_STREAM flag was incorrectly treated as an
error. Now, a single RST_STREAM(NO_ERROR) is properly handled.
This fixes problems observed with modern grpc-c [1], as well
as with the Go gRPC module.
[1] https://github.com/grpc/grpc/pull/1661
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 23 Apr 2020 15:10:24 +0300 |
parents | 7296b38f6416 |
children |
rev | line source |
---|---|
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
1 |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
2 /* |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
3 * Copyright (C) Nginx, Inc. |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
4 */ |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
5 |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
6 |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
7 #include <ngx_config.h> |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
8 #include <ngx_core.h> |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
9 |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
10 |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
11 #if (NGX_HAVE_CPUSET_SETAFFINITY) |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
12 |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
13 void |
6402
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
14 ngx_setaffinity(ngx_cpuset_t *cpu_affinity, ngx_log_t *log) |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
15 { |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 ngx_uint_t i; |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
17 |
6402
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
18 for (i = 0; i < CPU_SETSIZE; i++) { |
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
19 if (CPU_ISSET(i, cpu_affinity)) { |
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
20 ngx_log_error(NGX_LOG_NOTICE, log, 0, |
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
21 "cpuset_setaffinity(): using cpu #%ui", i); |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
22 } |
6402
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
23 } |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
24 |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
25 if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, |
6402
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
26 sizeof(cpuset_t), cpu_affinity) == -1) |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
27 { |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
28 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
29 "cpuset_setaffinity() failed"); |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
30 } |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
31 } |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
32 |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
33 #elif (NGX_HAVE_SCHED_SETAFFINITY) |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
34 |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
35 void |
6402
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
36 ngx_setaffinity(ngx_cpuset_t *cpu_affinity, ngx_log_t *log) |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
37 { |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
38 ngx_uint_t i; |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
39 |
6402
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
40 for (i = 0; i < CPU_SETSIZE; i++) { |
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
41 if (CPU_ISSET(i, cpu_affinity)) { |
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
42 ngx_log_error(NGX_LOG_NOTICE, log, 0, |
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
43 "sched_setaffinity(): using cpu #%ui", i); |
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
44 } |
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
45 } |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
46 |
6402
7296b38f6416
Core: added support for more than 64 CPUs in worker_cpu_affinity.
Vladimir Homutov <vl@nginx.com>
parents:
4549
diff
changeset
|
47 if (sched_setaffinity(0, sizeof(cpu_set_t), cpu_affinity) == -1) { |
4549
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
48 ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
49 "sched_setaffinity() failed"); |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
50 } |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
51 } |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
52 |
f31162fefe01
worker_cpu_affinity: cleaned up Linux implementation, added FreeBSD support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
53 #endif |