Spike - Long Drop
processing during panic?
#405
Labels
spike
The deliverable for this card is one or more additional cards
Milestone
We may at some point want to do some time-consuming processing during a panic--for example, if we're holding data in memory that will at some point be written to the database, but a panic occurs before the write is scheduled, we might want to do the writes to the database after the panic occurs but before the program actually halts.
We don't know at this point whether all three operating systems will allow us to run for several seconds during a panic: it seems reasonable that after telling a process to terminate, an OS would keep track of it and forcibly kill it if it didn't die after a short time.
Write a test (suggested project:
masq_lib
) that involves astruct
for which theDrop
trait is implemented. Have theDrop
handler do something that takes ten or fifteen seconds--something other than just sleeping, since the OS is in charge of sleeping and may deceive us during a panic. Create an instance of thestruct
and panic; see if theDrop
handler is permitted to take all the time it needs, or whether it's interrupted by the OS. (This test may be a little ticklish, since it involves a panic.)We are pretty sure Linux will wait for at least fifteen seconds; we don't know about macOS or Windows.
The test doesn't need to become a permanent part of the codebase, since it will necessarily suck up lots of test runtime, but the results of the test should be appended to this card for posterity, so that we can come back and look at them after we forget what happens.
The text was updated successfully, but these errors were encountered: