Repository navigation
Commit bb86bef
[frontend_server] Don't crash when recompiling before the first accept
`writeJavaScriptBundle` dereferenced `_generator.lastKnownGoodResult!`
whenever `fullComponent` was false. That value is only populated by
`IncrementalCompiler.accept()`, so it is null until the client has
accepted a compilation at least once. Since `recompileDelta` always
passes `fullComponent: false`, a `recompile` request that arrives before
the first `accept` request crashed with:
Null check operator used on a null value
#0 FrontendCompiler.writeJavaScriptBundle
dart-lang#1 FrontendCompiler.recompileDelta
dart-lang#2 listenAndCompile.<anonymous closure>
Nothing in the protocol requires `accept` to precede `recompile`, and
flutter_tools can violate that ordering: with `--machine`, the daemon
publishes the appId before the initial compile has been accepted, so an
`app.restart` can be serviced in between. Only the DDC path is affected;
`writeDillFile` never looks at `lastKnownGoodResult`.
When there is no accepted result, initialize the bundler from the
component instead of diffing against a previous one. This is equivalent
rather than a fallback: `IncrementalCompiler.compile()` returns the
combination of all deltas that have not been accepted yet, which is the
same component the initial `compile` request passes to
`bundler.initialize`.
Also replaces the same null check in `compileExpressionToJs` with a
proper error report.
Fixes flutter/flutter#192227
TEST=pkg/frontend_server/test/frontend_server_test.dart
Change-Id: I50a2b307acfa58bd796c69df45eba4c3dd271aad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/548680
Reviewed-by: Sigmund Cherem <[email protected]>
Reviewed-by: Ben Konyi <[email protected]>
Commit-Queue: Ben Konyi <[email protected]>1 parent acad943 commit bb86bef
3 files changed
Lines changed: 116 additions & 3 deletions
File tree
- pkg
- front_end/test
- frontend_server
- lib
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
| 479 | + | |
479 | 480 | | |
480 | 481 | | |
481 | 482 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1092 | 1092 | | |
1093 | 1093 | | |
1094 | 1094 | | |
1095 | | - | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
1096 | 1104 | | |
1097 | 1105 | | |
1098 | 1106 | | |
1099 | 1107 | | |
1100 | | - | |
| 1108 | + | |
1101 | 1109 | | |
1102 | 1110 | | |
1103 | 1111 | | |
| |||
1411 | 1419 | | |
1412 | 1420 | | |
1413 | 1421 | | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
1414 | 1430 | | |
1415 | 1431 | | |
1416 | 1432 | | |
| |||
1419 | 1435 | | |
1420 | 1436 | | |
1421 | 1437 | | |
1422 | | - | |
1423 | 1438 | | |
1424 | 1439 | | |
1425 | 1440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2275 | 2275 | | |
2276 | 2276 | | |
2277 | 2277 | | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
| 2342 | + | |
| 2343 | + | |
| 2344 | + | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
2278 | 2375 | | |
2279 | 2376 | | |
2280 | 2377 | | |
| |||
0 commit comments