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.
1) Mount a PVCS filesystem (or another filesystem that have EDIT command defined and provides some GUI output (e.g. set "Show Output" to true)). 2) On Advanced tab in the customizer (or wizard) uncheck "Prompt for EDIT Command Execution". 3) Make an attempt to modify a read-only file. A deadlock will occur, because VcsFileSystem.lock() is called in AWT, waits for the command to finish and the command makes an attempt to show some GUI.
Created attachment 12349 [details] The thread dump in build #200311231900
Scheduling for 4.0. Unfortunately, FileObject.lock() can be called in any thread (including AWT). Thus IMHO there are just two possibilities how to fix this: a) Disable the ability to run the EDIT/LOCK command directly in lock() method (remove the "Prompt for EDIT Command Execution" check box and have the prompt by default), b) Create somehow another event loop in lock() method while waiting for the command so that it can open the GUI.
There is also similar deadlock if UserQuestionException.confirmed() is called in AWT thread (see issue #32628). Therefore solution (a) would only solve a part of the problem, since I'm not sure that it is technically possible not to run confirmed() in another thread then AWT in some cases (see issue #31913). Solution (b) looks promising, but only Dialog.show() can be used reliably for this purpose (where Dialog is a modal dialog). It's not possible to start another event pump without calling private methods and classes of java.awt.* package. Therefore a next suggested solution, that would solve both this and issue #32628 is: c) create a modal dialog that would wait for the command to finish (and possibly display some progress bar and cancel/close button). That dialog should also have ability to wrap the possible command output into itself. If this could be implemented, issue #37364 is not necessary and both VcsFileSystem.lock() and UserQuestionException.confirmed() could be called from any thread.
The HIE team do not like much the (c) solution. This solution is especially needed for changes comming from the property sheet where confirmed() method is executed in AWT. The source of the problem is issue #31913. Perhaps this issue should be solved in a different way...
Since this is P1 and we need a quick solution, I will implement the solution (c). According to initial tests this solution will be possible and should work O.K. But it will block the user until the command is finished.
The problem is fixed in trunk as proposed: /cvs/vcsgeneric/profiles/cvsprofiles/src/org/netbeans/modules/vcs/profiles/cvsprofiles/visualizers/OutputVisualizer.java,v <-- OutputVisualizer.java new revision: 1.8; previous revision: 1.7 /cvs/vcscore/src/org/netbeans/modules/vcscore/commands/DialogVisualizerWrapper.java,v done Checking in vcscore/src/org/netbeans/modules/vcscore/commands/DialogVisualizerWrapper.java; /cvs/vcscore/src/org/netbeans/modules/vcscore/commands/DialogVisualizerWrapper.java,v <-- DialogVisualizerWrapper.java initial revision: 1.1 done RCS file: /cvs/vcscore/src/org/netbeans/modules/vcscore/commands/DialogVisualizerWrapper.form,v done Checking in vcscore/src/org/netbeans/modules/vcscore/commands/DialogVisualizerWrapper.form; /cvs/vcscore/src/org/netbeans/modules/vcscore/commands/DialogVisualizerWrapper.form,v <-- DialogVisualizerWrapper.form initial revision: 1.1 done Checking in vcscore/src/org/netbeans/modules/vcscore/commands/Bundle.properties; /cvs/vcscore/src/org/netbeans/modules/vcscore/commands/Bundle.properties,v <-- Bundle.properties new revision: 1.26; previous revision: 1.25 done Checking in vcscore/src/org/netbeans/modules/vcscore/commands/CommandOutputPanel.java; /cvs/vcscore/src/org/netbeans/modules/vcscore/commands/CommandOutputPanel.java,v <-- CommandOutputPanel.java new revision: 1.25; previous revision: 1.24 done Checking in vcscore/src/org/netbeans/modules/vcscore/commands/CommandOutputVisualizer.java; /cvs/vcscore/src/org/netbeans/modules/vcscore/commands/CommandOutputVisualizer.java,v <-- CommandOutputVisualizer.java new revision: 1.25; previous revision: 1.24 done Checking in vcscore/src/org/netbeans/modules/vcscore/commands/VcsCommandVisualizer.java; /cvs/vcscore/src/org/netbeans/modules/vcscore/commands/VcsCommandVisualizer.java,v <-- VcsCommandVisualizer.java new revision: 1.5; previous revision: 1.4 done Checking in vcscore/src/org/netbeans/modules/vcscore/commands/VcsDescribedCommand.java; /cvs/vcscore/src/org/netbeans/modules/vcscore/commands/VcsDescribedCommand.java,v <-- VcsDescribedCommand.java new revision: 1.4; previous revision: 1.3 done Checking in vcscore/src/org/netbeans/modules/vcscore/VcsFileSystem.java; /cvs/vcscore/src/org/netbeans/modules/vcscore/VcsFileSystem.java,v <-- VcsFileSystem.java new revision: 1.238; previous revision: 1.237 done Processing log script arguments... More commits to come... Checking in vcscore/src/org/netbeans/modules/vcscore/cmdline/UserCommandSupport.java; /cvs/vcscore/src/org/netbeans/modules/vcscore/cmdline/UserCommandSupport.java,v <-- UserCommandSupport.java new revision: 1.29; previous revision: 1.28 done Processing log script arguments... More commits to come... Checking in vcscore/src/org/netbeans/modules/vcscore/runtime/VcsRuntimeCommand.java; /cvs/vcscore/src/org/netbeans/modules/vcscore/runtime/VcsRuntimeCommand.java,v <-- VcsRuntimeCommand.java new revision: 1.17; previous revision: 1.16 done /cvs/javacvs/src/org/netbeans/modules/cvsclient/commands/CommandLineInfoPanel.java,v <-- CommandLineInfoPanel.java new revision: 1.14; previous revision: 1.13
A description of the fix and it's variants: 1) Have a read-only file under CVS filesystem. In Advanced tab of the customizer uncheck "Prompt for EDIT Command Execution". Open the read-only file in Editor and try to write into it. A modal dialog is opened with a progress bar and with "Cancel" button. After the command is finished and the dialog is closed, you will see your modification in the Editor, the file is modified. 2) Have a read-only file under PVCS filesystem. In Advanced tab of the customizer uncheck "Prompt for EDIT Command Execution". Open the read-only file in Editor and try to write into it. A modal dialog is opened with the output of the command that is the same dialog that is used for output of Get command. You can use the Input line to provide an input when necessary. After the command is finished and the dialog is closed, you will see your modification in the Editor, the file is modified. 3/4) Have a read-only Java file under CVS or PVCS filesystem. That Java file should have at least one field defined. Expand the Java class in explorer and select the field. Open Properties on it, change it's name and press Enter. Depending on whether you have "Prompt for EDIT Command Execution" turned on, you'll get a confirmation to run the command. The command is executed and a modal dialog is created with a progress bar or command output depending on whether you have CVS or PVCS filesystem. After the command succeeds the field is renamed, if the command fails or if you kill it before it change the state of the file, you're notified that the file is still read-only and the field stays there with the original name. 5) Have a read-only Java file under PVCS filesystem. In Advanced tab of the customizer check "Prompt for EDIT Command Execution" on. Open Properties window and open the Java file in Editor. Have selected a field of the file in Explorer (so that you see it's properties in Properties window). Now write to the Editor, confirm the EDIT command. As soon as it executes, change the name of the field in the Properties Window. You'll get a modal dialog with a progress bar, that will wait till the command finish. (This behavior is thanks to fix of issue #37580, if that issue is not fixed, you will get a deadlock here). The same applies to LOCK command (on systems where LOCK command is defined).
ok in NB36 beta