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.
Summary: | [70cat] ArrayIndexOutOfBoundsException: -1 | ||
---|---|---|---|
Product: | platform | Reporter: | pcdinh <pcdinh> |
Component: | Progress | Assignee: | apireviews <apireviews> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | aldobrucale, Chiana, exceptions_reporter, hmichel, jglick, mmirilovic, musilt2, myururdurmaz, scanti, simpatico |
Priority: | P2 | Keywords: | API_REVIEW_FAST, THREAD |
Version: | 7.0 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | 171061 |
Attachments: |
stacktrace
stacktrace Synchronization in TaskModel Patch for API_REVIEW |
Description
pcdinh
2010-11-24 17:00:42 UTC
Created attachment 103298 [details]
stacktrace
Created attachment 108932 [details]
stacktrace
*** Bug 200057 has been marked as a duplicate of this bug. *** This bug already has 20 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=171061 Created attachment 111595 [details]
Synchronization in TaskModel
Possible fix for this issue
Bug description: Occurrence of this issue is random. It is caused by leak of synchronization within progress API (usage of TaskModel.java). Two or more threads are accessing TaskModel's fields at the same time. Waiver justification: Patch is ready to use (see bugzilla) but it could affect other module that are using this API. This API is widely used in NB so I would like to apply these changes in the next version and solve eventual regressions then. User impact: Exception dialog is shown. This issue was reported 6x in last three months (during different scenarios). -> Keywords: 7.1_WAIVER_REQUEST *** Bug 188999 has been marked as a duplicate of this bug. *** Created attachment 113454 [details]
Patch for API_REVIEW
This is a final patch, ready to be reviewed. Sync blocks were added for every access to "model" and "selectionModel" fields. Attached listeners (ListDataListener, ListSelectionListener) are added to lists and they are called in another thread after an event is fired to prevent performing listener's actions in sync blocks.
Please review last attached patch. I do not think this need to go through API review; org.netbeans.modules.progress.spi is not a public SPI. (The NB module system is incapable of expressing that this package should be visible only to o.n.m.progress.ui whereas the API should be public, but that is the intent.) Anyway it does not look like you are changing even the SPI, just its implementation; am I missing something? BTW the following diff: - public void addListSelectionListener(ListSelectionListener listener) { - selectionModel.addListSelectionListener(listener); + public void addListSelectionListener(ListSelectionListener listener) { + synchronized (selectionListeners) { + selectionListeners.add(listener); + } shows you adding whitespace to the end of a line but otherwise not changing it. (1) Diffs, especially for review, should avoid formatting changes. (2) When working on any NB code please set Tools > Options > Editor > General > Remove Trailing Whitespace to "From Modified Lines Only" so sources are not polluted by trailing whitespace. (ml-hgext [1] promises to deal with it before commit but I have not found it reliable yet.) [1] https://bitbucket.org/marcusl/ml-hgext/overview I was not sure if changes in threading have to be reviewed or not. But thanks for tip, that whitespace *** Bug 193861 has been marked as a duplicate of this bug. *** Do not forget to set Target Milestone when closing an issue as FIXED. (In reply to comment #11) > I was not sure if changes in threading have to be reviewed or not. If the changes affect how clients may or should call the API, then this aspect of the contract should be mentioned in Javadoc and changes deserve a review. In this case my impression was that the threading was an internal implementation detail. Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/284b651d4b71 User: Jan Peska <jpeska@netbeans.org> Log: Issue #192420 - [70cat] ArrayIndexOutOfBoundsException: -1 Synchronization added. See issue comments *** Bug 215228 has been marked as a duplicate of this bug. *** *** Bug 229393 has been marked as a duplicate of this bug. *** *** Bug 244997 has been marked as a duplicate of this bug. *** |