[plt-scheme] Cleanup on Servlet Timeout (Again)

From: Henk Boom (lunarc.lists at gmail.com)
Date: Wed Aug 27 23:45:17 EDT 2008

2008/8/21 Matthew Flatt <mflatt at cs.utah.edu>:
> Depending on the domain, though, there's one more problem beyond
> granting read and write access in a kill-safe way. What if a thread is
> terminated while it's in write mode? The "rwlock.ss" implementation
> treats termination the same as the completion, but that's valid only if
> each atomic step in writing keeps the relevant data consistent.
> Otherwise, you need some way to ensure that the write completes so that
> the data is consistent.
>
> If all you have is locks, then you're stuck on this second problem. If
> you have a process, though, the solution is pretty easy: delegate the
> writing work to the process that handles read and write access. (The
> writing work has to be trusted in this case, in the sense that it won't
> raise unexpected exceptions or things like that.) The enclosed
> "rwlock-complete-write.ss" illustrates the generalization or
> "rwlock.ss" to solve that problem.

I have another question in response to this. What if the thread which
is terminated was the last thread using this resourse? Then the server
thread is suspended and may never finish the write in that case
either, leaving the database in an inconsistent state.

    Henk


Posted on the users mailing list.