United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6607230 D3D: infinite wait is possible in D3DScreenUpdateManager.runUpdateNow()
6607230 : D3D: infinite wait is possible in D3DScreenUpdateManager.runUpdateNow()

Details
Type:
Bug
Submit Date:
2007-09-20
Status:
Closed
Updated Date:
2010-10-14
Project Name:
JDK
Resolved Date:
2007-10-09
Component:
client-libs
OS:
windows_xp
Sub-Component:
2d
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u5
Fixed Versions:
6u10

Related Reports

Sub Tasks

Description
It is possible to get into an infinite wait when using
D3DScreenUpdateManager.runUpdateNow().

                                    

Comments
SUGGESTED FIX

http://sa.sfbay.sun.com/projects/java2d_data/6u5/6607230.1
                                     
2007-09-21
EVALUATION

If the timing is just right such that the following sequence
of events happens:
  - there's a single onscreen surface created at some point, then disposed of
    (invalidated) at the same time as..
  - .. another thread calls Toolkit.sync() which ends up calling
    D3DScreenUpdateManager.runUpdateNow()
We could end up with the updater thread missing the notify() from 
runUpdateNow() and sleeping forever in runLock.wait().

There's a related problem in using runLock.notify() - we should be using
notifyAll() since there may be multiple threads calling 
sync() and waiting for update to finish. Just using notify() will wake
up one of those threads, not necessarily the screen updater thread.

And there was an issue with the ordering of invalidating/replacing
onscreen surfaces in WComponentPeer.replaceSurfaceData() pointer by 
one of the reviewers - we typically first replace teh surface, then
invalidate the old one. In WComponentPeer the order was reversed because
we needed to remove the d3d onscreen surface from the list of managed
surfaces. This could be done by other means, avoiding issues with creating
a graphics with already invalidated surface.
                                     
2007-09-20



Hardware and Software, Engineered to Work Together