Commit cd3415f
authored
Add better shutdown handling for tessera (#432)
Before this change. it was possible for Tessera to get in the way of the
process shutting down in two ways:
1) The context in the Appender did not respond to signals, so if it ran
into an irrecoverable error in `integrateEntriesJob`, it would retry
indefinitely and the process would not end shutdown.
2) The appender Shutdown function also runs in an indefinite loop, and
if Tessera got into a corrupt state where it could never finish
appending the sequenced entries, the shutdown loop would never
terminate.
This change adds a new timeout parameter specifically for Tessera to
give it a maximum time to finish processing entries. In the event it is
stuck looping trying to process an unprocessable entry, it will now
terminate in response to SIGINT/SIGTERM.
The default timeout for the server timeout, which is shared by the HTTP
and gRPC servers, is reduced to 20s, which in a correctly functioning
system with a checkpoint period of 10s should be long enough to finish
processing all in-flight requests. The new tessera timeout is 30s. This
means that in a badly behaving system where tessera did not integrate
entries in time to send the response to clients, it still has 30s to try
to finish committing entries to the log and empty the Spanner queue.
In the event that tessera encounters an irrecoverable error and cannot
finish processing entries, the maximum time to shut down is 50s by
default. This is reduced from 60s (server idle timeout) + indefinite
(tessera loop). The Pod termination grace period should be extended to
50-60s accordingly.
Signed-off-by: Colleen Murphy <[email protected]>1 parent 999b9fe commit cd3415f
File tree
4 files changed
+13
-8
lines changed- cmd/rekor-server/app
- internal/server
4 files changed
+13
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
| |||
185 | 186 | | |
186 | 187 | | |
187 | 188 | | |
188 | | - | |
| 189 | + | |
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| |||
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
| 222 | + | |
221 | 223 | | |
222 | 224 | | |
223 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
0 commit comments