Bug 183632 - Deadlock when C/C++ project is renamed
Deadlock when C/C++ project is renamed
Status: RESOLVED FIXED
Product: cnd
Classification: Unclassified
Component: Project
6.x
PC Linux
: P3 (vote)
: 6.x
Assigned To: Alexander Simon
issues@cnd
: THREAD
Depends on: 162927 183680 183681
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-07 09:18 UTC by soldatov
Modified: 2010-05-19 06:18 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments
stack if IDE hangs (28.36 KB, text/plain)
2010-04-07 09:18 UTC, soldatov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description soldatov 2010-04-07 09:18:59 UTC
Created attachment 96850 [details]
stack if IDE hangs

It is a not stable problem.
Scenario:
- Create C/C++ Application
- Add 2-3 source file into project
- Call context menu on project. Select Rename
- Type "CppApplication_1lll" instead of "CppApplication_1" in "Project Name" text field ("Also Rename Project Folder" is switched off)
- Press "Rename" button
==> Exception or IDE hangs
Comment 1 soldatov 2010-04-07 09:35:37 UTC
SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.netbeans.modules.project.ui.actions.CloseProject$1
java.lang.IllegalStateException: An attempt to call ProjectState.markModified on a deleted project: MasterFileObject[/Users/tester/NetBeansProjects/CppApplication_1@14a60da:15e71ea,valid=true]
        at org.netbeans.api.project.ProjectManager$ProjectStateImpl$1.run(ProjectManager.java:548)
        at org.netbeans.api.project.ProjectManager$ProjectStateImpl$1.run(ProjectManager.java:545)
        at org.openide.util.Mutex.writeAccess(Mutex.java:394)
        at org.netbeans.api.project.ProjectManager$ProjectStateImpl.markModified(ProjectManager.java:545)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.modifying(AntProjectHelper.java:517)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.access$900(AntProjectHelper.java:106)
        at org.netbeans.spi.project.support.ant.AntProjectHelper$10.run(AntProjectHelper.java:956)
        at org.netbeans.spi.project.support.ant.AntProjectHelper$10.run(AntProjectHelper.java:929)
        at org.openide.util.Mutex.writeAccess(Mutex.java:394)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.putConfigurationFragment(AntProjectHelper.java:929)
        at org.netbeans.spi.project.support.ant.ExtensibleMetadataProviderImpl.putConfigurationFragment(ExtensibleMetadataProviderImpl.java:87)
        at org.netbeans.modules.projectapi.AuxiliaryConfigImpl$2.run(AuxiliaryConfigImpl.java:143)
        at org.netbeans.modules.projectapi.AuxiliaryConfigImpl$2.run(AuxiliaryConfigImpl.java:134)
        at org.openide.util.Mutex.writeAccess(Mutex.java:394)
        at org.netbeans.modules.projectapi.AuxiliaryConfigImpl.putConfigurationFragment(AuxiliaryConfigImpl.java:134)
        at org.netbeans.modules.project.ui.ProjectUtilities.storeProjectOpenFiles(ProjectUtilities.java:477)
        at org.netbeans.modules.project.ui.ProjectUtilities.closeAllDocuments(ProjectUtilities.java:454)
        at org.netbeans.modules.project.ui.OpenProjectList.close(OpenProjectList.java:753)
        at org.netbeans.modules.project.ui.actions.CloseProject.actionPerformed(CloseProject.java:82)
        at org.netbeans.modules.project.ui.actions.CloseProject$1.run(CloseProject.java:75)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1369)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1907)
Caused: org.openide.util.RequestProcessor$SlowItem: task failed due to
        at org.openide.util.RequestProcessor.post(RequestProcessor.java:368)
        at org.netbeans.modules.project.ui.actions.CloseProject.actionPerformed(CloseProject.java:72)
        at org.netbeans.modules.project.ui.actions.LookupSensitiveAction.actionPerformed(LookupSensitiveAction.java:166)
        at org.netbeans.modules.project.uiapi.DefaultProjectOperationsImplementation$7.run(DefaultProjectOperationsImplementation.java:694)
        at org.netbeans.modules.project.uiapi.DefaultProjectOperationsImplementation$7.run(DefaultProjectOperationsImplementation.java:686)
        at org.openide.util.Mutex$1AWTWorker.run(Mutex.java:1370)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
        at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:133)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:205)
        at java.awt.Dialog$1.run(Dialog.java:1045)
        at java.awt.Dialog$3.run(Dialog.java:1097)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Dialog.show(Dialog.java:1095)
        at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:988)
        at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:1022)
        at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:1010)
        at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:118)
        at org.openide.util.Mutex.doEventAccess(Mutex.java:1355)
        at org.openide.util.Mutex.readAccess(Mutex.java:268)
        at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:995)
        at java.awt.Component.show(Component.java:1563)
        at java.awt.Component.setVisible(Component.java:1515)
        at java.awt.Window.setVisible(Window.java:841)
        at java.awt.Dialog.setVisible(Dialog.java:985)
        at org.netbeans.modules.project.uiapi.DefaultProjectOperationsImplementation.showConfirmationDialog(DefaultProjectOperationsImplementation.java:636)
        at org.netbeans.modules.project.uiapi.DefaultProjectOperationsImplementation.renameProject(DefaultProjectOperationsImplementation.java:351)
        at org.netbeans.spi.project.ui.support.DefaultProjectOperations.performDefaultRenameOperation(DefaultProjectOperations.java:155)
        at org.netbeans.modules.cnd.makeproject.MakeActionProvider.invokeAction(MakeActionProvider.java:260)
        at org.netbeans.modules.project.ui.actions.ProjectAction.actionPerformed(ProjectAction.java:131)
        at org.netbeans.modules.project.ui.actions.LookupSensitiveAction.actionPerformed(LookupSensitiveAction.java:166)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
        at javax.swing.AbstractButton.doClick(AbstractButton.java:389)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1223)
        at com.apple.laf.AquaMenuItemUI.doClick(AquaMenuItemUI.java:137)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1264)
        at java.awt.Component.processMouseEvent(Component.java:6348)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
        at java.awt.Component.processEvent(Component.java:6113)
        at java.awt.Container.processEvent(Container.java:2085)
        at java.awt.Component.dispatchEventImpl(Component.java:4714)
        at java.awt.Container.dispatchEventImpl(Container.java:2143)
        at java.awt.Component.dispatchEvent(Component.java:4544)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4282)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4212)
        at java.awt.Container.dispatchEventImpl(Container.java:2129)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4544)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
        at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:133)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
[catch] at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Resolving dependencies took: 7 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 0 binary roots took: 0 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 0 source roots took: 0 ms (New or modified files: 0, Deleted files: 0)
Comment 2 Alexander Simon 2010-04-07 09:40:20 UTC
Reassign for investigation.
IMHO root problem is:
- ProjectOpenedHook methods do not synchronized with DataFilesProviderImplementation.notify*ing methods.
As result CND project has races.
Comment 3 Jesse Glick 2010-04-08 01:29:40 UTC
Though I cannot reproduce any problem in a j2seproject, there seem to be several things going on here.

1. Too much stuff is happening for a simple rename (i.e. "Also Rename Project Folder" unchecked). Tracked as bug #183680.

2. ISEs can apparently be thrown under conditions still mysterious to me, but in this case possibly a consequence of #1. Probably better to just downgrade this to a log message. Tracked as bug #162927.

3. In the case of CND projects, you have a deadlock of your own making. MakeConfigurationDescriptor.save is waiting for another thread, MakeConfigurationDescriptor$SaveRunnable.run, which acquires its own locks. Additionally, it is impermissible for a FileOwnerQuery implementation, which exists at the base project system level, to make a blocking call into OpenProjects, which exists at the UI level. (Perhaps you meant to use FileOwnerQuery.markExternalOwner?)

4. OpenProjectList uses excessive locks. Tracked as bug #183681.
Comment 4 Alexander Simon 2010-04-09 17:19:13 UTC
(In reply to comment #3)
> Though I cannot reproduce any problem in a j2seproject, there seem to be
> several things going on here.
> 
> 1. Too much stuff is happening for a simple rename (i.e. "Also Rename Project
> Folder" unchecked). Tracked as bug #183680.
> 
> 2. ISEs can apparently be thrown under conditions still mysterious to me, but
> in this case possibly a consequence of #1. Probably better to just downgrade
> this to a log message. Tracked as bug #162927.
> 
> 3. In the case of CND projects, you have a deadlock of your own making.
> MakeConfigurationDescriptor.save is waiting for another thread,
> MakeConfigurationDescriptor$SaveRunnable.run, which acquires its own locks.
> Additionally, it is impermissible for a FileOwnerQuery implementation, which
> exists at the base project system level, to make a blocking call into
> OpenProjects, which exists at the UI level. (Perhaps you meant to use
> FileOwnerQuery.markExternalOwner?)

Jesse, I do not agree.
The dead lock do not CND making.
CND need to save project xml and configuration xml.
Project API mast to allow to do it.
IMHO deadlock depend on:
- #183681
- and see my comment #2
My piont of view:
-actions in the DataFilesProviderImplementation.notify*ing methods should precede other actions (close/open).
 
> 4. OpenProjectList uses excessive locks. Tracked as bug #183681.
Comment 5 Jesse Glick 2010-04-09 18:49:59 UTC
(In reply to comment #4)
>> it is impermissible for a FileOwnerQuery implementation, which
>> exists at the base project system level, to make a blocking call into
>> OpenProjects, which exists at the UI level. (Perhaps you meant to use
>> FileOwnerQuery.markExternalOwner?)

This was not addressed.

> CND need to save project xml and configuration xml.
> Project API mast to allow to do it.

It does. That is not a source of the deadlock. The contributing factor from CND is the illicit FOQI, as above, which leads to a lock misordering (ProjectManager.MUTEX -> OpenProjectList).

> deadlock depend on:
> - #183681

Yes, that is another contributing factor, and that is why it is open as a separate issue.

> -actions in the DataFilesProviderImplementation.notify*ing methods should
> precede other actions (close/open).

Probably not possible to do that, since destructive operations on an open project are dangerous. Note however that as of bug #183680 nothing is closed or opened in the case of a simple rename (as in the test case given here).
Comment 6 Alexander Simon 2010-05-13 11:56:08 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/e2a948feaf68
Comment 7 Quality Engineering 2010-05-17 15:31:40 UTC
Integrated into 'main-golden', will be available in build *201005170932* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/
User: 
Log:
Comment 8 Quality Engineering 2010-05-19 06:18:15 UTC
Integrated into 'main-golden', will be available in build *201005182201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/
User: 
Log:


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo