Issue 142: Stopping preemption causes null reference exception
http://code.google.com/p/v8/issues/detail?id=142
New issue report by jcpstuff:
Using several threads and calling Start/Stop preemption works well for the
most part. Sometimes what will happen, though, is a null deferencing in
ContextSwitcher::PreemptionReceived(). After tracing the execution, this
seems to be what happens:
Thread A calls StartPreemption and begins executing Javascript.
The ContextSwitcher thread C spins up.
Thread B calls StopPreemption (for another reason I will add another bug
for; namely, Context creation is not preemption-safe).
Thread B, in ContextSwitcher::Stop, sets keep_going_ to false and signals
the preemption semaphore.
Thread C is done with its wait time, signals preemption, waits for the
semaphore (which is already signaled), sees that keep_going_ is false, and
exits. The preemption flag has been set, though.
Thread A resumes execution and finds that it has been preempted. It calls
ContextSwitcher::PreemptionReceived.
Thread A dereferences the switcher variable, even though it has been
nulled out in ContextSwitcher::StopPreemption.
To fix, switcher needs to be marked as volatile.
ContextSwitcher::PreemptionReceived needs to check that switcher != null,
and the implementation of StopPreemptionneeds to set switcher to null
before deleting it.
Issue attributes:
Status: New
Owner: ----
--
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
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---