MailboxProcessor und Ausnahmen
Ich wundere mich warumMailboxProcessor
Die Standardstrategie für die Behandlung von Ausnahmen ist gerechtim stillen ignorieren Sie. Zum Beispiel:
let counter =
MailboxProcessor.Start(fun inbox ->
let rec loop() =
async { printfn "waiting for data..."
let! data = inbox.Receive()
failwith "fail" // simulate throwing of an exception
printfn "Got: %d" data
return! loop()
}
loop ())
()
counter.Post(42)
counter.Post(43)
counter.Post(44)
Async.Sleep 1000 |> Async.RunSynchronously
und nichts passiert. Es gibt keinen schwerwiegenden Stopp der Programmausführung oder ein Meldungsfeld mit der Meldung "Eine nicht behandelte Ausnahme". Nichts.
Diese Situation wird schlimmer, wenn jemand verwendetPostAndReply
Methode: ein garantierter Deadlock als Ergebnis.
Gründe für ein solches Verhalten?