This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 139265 - Data race in DataViewPageContext
Summary: Data race in DataViewPageContext
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Show Data (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: _ ahimanikya
URL:
Keywords: THREAD
Depends on:
Blocks:
 
Reported: 2008-07-08 15:11 UTC by Andrei Badea
Modified: 2008-07-09 15:50 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Badea 2008-07-08 15:11:25 UTC
The following code in DVPC

    void setCurrentRows(List<Object[]> rows) {
        synchronized(rows) {
            this.rows = rows;
        }
    }

doesn't do any meaningful synchronization: you need to synchnonize on the same object -- in this case, on this.
Moreover, the reads of the rows field are not sychnronized throughout the class, which results in data races.
Comment 1 _ ahimanikya 2008-07-08 15:29:25 UTC
Agree this synchronized is not required. Removed it
http://hg.netbeans.org/dbdataview/rev/d6668a77eae4
Comment 2 Andrei Badea 2008-07-08 15:55:30 UTC
Synchronization is needed, since you set the rows in the execution thread, but also read the rows in the AWT thread.
Actually, this seems to be the case for the whole DataViewPageContext class.
Comment 3 _ ahimanikya 2008-07-08 16:01:05 UTC
Then may be you can help me point out where we need Synchronization. 
Comment 4 Andrei Badea 2008-07-08 16:27:26 UTC
You need synchronization whenever you read and write a field from multiple threads.

http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html
Comment 5 _ ahimanikya 2008-07-09 04:27:00 UTC
http://hg.netbeans.org/dbdataview/rev/818bfa913213
I think this is fixed. If you still find issues, be specific and reopen. 
Comment 6 Roman Mostyka 2008-07-09 15:50:07 UTC
Verified with build 080709.