[Seaside-dev] Issue 23 in seaside: Race condition in WAProcessMonitor

codesite-noreply at google.com codesite-noreply at google.com
Mon Mar 3 09:44:17 UTC 2008


Issue 23: Race condition in WAProcessMonitor
http://code.google.com/p/seaside/issues/detail?id=23

New issue report by bonz... at gnu.org:
There is a race condition in WAProcessMonitor>>#critical:ifError: --
basically, it is unsafe to assign the result of #fork and use it anywhere
but in the current method.  The newly forked process might start before the
instance variable is assigned, and another process might think that no
process is running while in fact it is.  While rare (I found this by
inspection not because it actually happened), it is easy to fix, so why not.

Depending on the scheduler, it may affect some dialects more than others.

!WAProcessMonitor methodsFor: 'mutual exclusion'!

critical: aBlock ifError: anErrorBlock
        "Evaluate aBlock as a mutual exclusive block within a new processes
and wait for the process to finish. Evaluate anErrorBlock in case of a
problem. Answer the result of evaluating the blocks. Note, that the
semaphore needs to be an instance-variable, otherwise continuations might
screw up the debugger."

        | value |
        mutex critical:
                [semaphore := SeasidePlatformSupport semaphoreClass new.
                process := [[value := aBlock on: Error do: anErrorBlock]
			ensure: [semaphore signal]] newProcess.
                process resume.
                semaphore wait.
                process := nil].
        ^value
!


Issue attributes:
	Status: New
	Owner: ----
	Labels: Type-Defect Priority-Medium

-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


More information about the seaside-dev mailing list