| 434 | } |
| 435 | |
| 436 | void rollRandomClose() { |
| 437 | // make sure connections between parenta and their childs are not closed |
| 438 | if (!stableConnection && |
| 439 | now() - g_simulator.lastConnectionFailure > g_simulator.connectionFailuresDisableDuration && |
| 440 | deterministicRandom()->random01() < .00001) { |
| 441 | g_simulator.lastConnectionFailure = now(); |
| 442 | double a = deterministicRandom()->random01(), b = deterministicRandom()->random01(); |
| 443 | CODE_PROBE(true, "Simulated connection failure", probe::context::sim2, probe::assert::simOnly); |
| 444 | TraceEvent("ConnectionFailure", dbgid) |
| 445 | .detail("MyAddr", process->address) |
| 446 | .detail("PeerAddr", peerProcess->address) |
| 447 | .detail("PeerIsValid", peer.isValid()) |
| 448 | .detail("SendClosed", a > .33) |
| 449 | .detail("RecvClosed", a < .66) |
| 450 | .detail("Explicit", b < .3); |
| 451 | if (a < .66 && peer) |
| 452 | peer->closeInternal(); |
| 453 | if (a > .33) |
| 454 | closeInternal(); |
| 455 | // At the moment, we occasionally notice the connection failed immediately. In principle, this could happen |
| 456 | // but only after a delay. |
| 457 | if (b < .3) |
| 458 | throw connection_failed(); |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | ACTOR static Future<Void> trackLeakedConnection(Sim2Conn* self) { |
| 463 | wait(g_simulator.onProcess(self->process)); |
no test coverage detected