Commit 7c5920a
avoid invariant violations due to previously crashed processes
Summary:
Prior to this diff, the following sequence of events caused an invariant violation:
1. `hh_server` is not running.
2. Some other application A crashes while asserting a state X, leaving a spurious X.notify file
3. `hh_server` is started, and correctly considers state X as not being asserted
4. Application A is started again and asserts X again. This causes it to delete the X.notify file first, which triggers a `StateLeave(X)` event followed by a `StateEnter(X)`.
5. `hh_server` receives `StateLeave(X)` violating the invariant that we must note leave a state that's not asserted.
Note that this can only happen if A crashed *before* hh was started. We already handle the case correctly when an application asserting a state crashes while `hh_server` is running.
This diff fixes this issue: As of D91942985, `which_states_asserted` cleans up all spurious X.notify files for us during server initialization. The only thing this diff does is ensuring that we ask Eden for the initial journal position during initialization *after* calling `which_states_asserted`, so that we skip over the `StateLeave` events due to the cleanup. Note that this also means that our code in `Edenfs_watcher` continues not to interact with .notify files.
As a drive-by change, I'm also switching us from using `get_asserted_states` to `which_states_asserted` for getting the initially asserted states during server start. The only difference between the two is that the latter is supposed to be the public API and does the filtering of state names for us.
All the changes in this diff only affect behaviour if `edenfs_file_watcher_state_tracking` is enabled, which is disabled for everyone at the moment.
Reviewed By: Alramech
Differential Revision: D92404246
fbshipit-source-id: 88f21edbc46737ebc173e0ce7fec8d1c4b4fe19b1 parent 86b9702 commit 7c5920a
1 file changed
Lines changed: 73 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
| 457 | + | |
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
463 | | - | |
| 463 | + | |
464 | 464 | | |
465 | 465 | | |
466 | 466 | | |
| 467 | + | |
467 | 468 | | |
468 | 469 | | |
469 | 470 | | |
| |||
496 | 497 | | |
497 | 498 | | |
498 | 499 | | |
499 | | - | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
500 | 504 | | |
501 | 505 | | |
502 | 506 | | |
| |||
1155 | 1159 | | |
1156 | 1160 | | |
1157 | 1161 | | |
1158 | | - | |
| 1162 | + | |
1159 | 1163 | | |
1160 | 1164 | | |
1161 | 1165 | | |
| |||
1200 | 1204 | | |
1201 | 1205 | | |
1202 | 1206 | | |
1203 | | - | |
| 1207 | + | |
1204 | 1208 | | |
1205 | 1209 | | |
1206 | 1210 | | |
| |||
1239 | 1243 | | |
1240 | 1244 | | |
1241 | 1245 | | |
1242 | | - | |
| 1246 | + | |
1243 | 1247 | | |
1244 | 1248 | | |
1245 | 1249 | | |
| |||
1250 | 1254 | | |
1251 | 1255 | | |
1252 | 1256 | | |
1253 | | - | |
| 1257 | + | |
1254 | 1258 | | |
1255 | 1259 | | |
1256 | 1260 | | |
| |||
1304 | 1308 | | |
1305 | 1309 | | |
1306 | 1310 | | |
1307 | | - | |
| 1311 | + | |
1308 | 1312 | | |
1309 | 1313 | | |
1310 | 1314 | | |
| |||
1316 | 1320 | | |
1317 | 1321 | | |
1318 | 1322 | | |
1319 | | - | |
| 1323 | + | |
1320 | 1324 | | |
1321 | 1325 | | |
1322 | 1326 | | |
| |||
1350 | 1354 | | |
1351 | 1355 | | |
1352 | 1356 | | |
1353 | | - | |
| 1357 | + | |
1354 | 1358 | | |
1355 | 1359 | | |
1356 | 1360 | | |
| |||
1377 | 1381 | | |
1378 | 1382 | | |
1379 | 1383 | | |
1380 | | - | |
| 1384 | + | |
1381 | 1385 | | |
1382 | 1386 | | |
1383 | 1387 | | |
| |||
1394 | 1398 | | |
1395 | 1399 | | |
1396 | 1400 | | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
1397 | 1459 | | |
1398 | 1460 | | |
1399 | 1461 | | |
| |||
0 commit comments