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 121911 - Clone Other wizard broken after cancelling previous Clone
Summary: Clone Other wizard broken after cancelling previous Clone
Status: VERIFIED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 6.x
Hardware: All Windows 3.1/NT
: P3 blocker (vote)
Assignee: issues@versioncontrol
URL:
Keywords: RELNOTE
: 126979 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-14 14:32 UTC by novakm
Modified: 2008-03-03 11:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Some ideas on using setCancelable() (5.25 KB, text/plain)
2007-11-16 12:34 UTC, John Rice
Details

Note You need to log in before you can comment on or make changes to this bug.
Description novakm 2007-11-14 14:32:08 UTC
Note that I did not add anything such as "ssh = d:/Install/putty/plink -ssh -l user" into mercurial.ini. I believe the
described problem can be achieved even in other ways but this one is how I am able to reproduce.
Steps to reproduce:
1) Versioning | Invoke Mercurial | Clone Other... from main menu.
2) Enter valid (well it can be even invalid...) repository path and push Next
3) Enter valid Name and Directory in last step and push Finish
result: Progressbar with text Cloning... apears. Of course it won't ever finish as there is no ssh command specified.
Same result is from command line, that's not the problem. The real problem is that after you cancel it clicking the
cross on progress bar and confirming, the Clone Other... wizard is broken and unusable. If you invoke it again, the URL
is still there but the rest of the wizard suggest it is in wrong format. Even when you type different one, it doesn't
work. Pushing the Next button does nothing, you are still left in the first step afterwards.

Using nbm for RC1 but I guess this problem is even in older builds

----
Product Version: NetBeans IDE 6.0 RC1 (Build 200711131200)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: Windows Vista version 6.0 running on x86;
Comment 1 John Rice 2007-11-14 21:23:31 UTC
I'm running the dev build from head on Win XP, with hg 0.9.5 and I'm not seeing the issues you describe. I can't get to
the cancel button quickly enough.

Can you describe to me which URL's you are using and I'll see if I can repo it.
Comment 2 novakm 2007-11-15 07:45:19 UTC
I can email you the repo location if you want, but I believe there is not problem in the repo, but in the external ssh
command. I guess you have some line like
ssh = <path to something like ssh on windows>
in your mercurial.ini? Or maybe you have some environmental variable with similar meaning. Try to remove them and then
you should be able to reproduce without any problem. If you don't have ssh specified, the progress bar never finishes so
you are forced to cancel it. And after that the Clone Other wizard is broken...
Comment 3 John Rice 2007-11-15 22:05:40 UTC
Applied workaround to CVS head to reset the RequestProcessor cache, so the Clone is no longer broken. 

However, I do not think we are cleanly exciting the hg clone command and this needs further investigation, so this hg
process is set a force kill.
Comment 4 John Rice 2007-11-16 12:12:54 UTC
Tried using the setCancellable hook, within the Clone Action, in the HgProgressSupport support, before calling
support.start(...):

support.setCancellableDelegate(new Cancellable() {
            public boolean cancel() {
                Process proc = HgCommand.getProcess();
                if (proc != null) {
                    proc.destroy();
                }
}

It does get invoked and does kill the top level process but it has several problems:
1. It just kills the top level process that was spawned and not any sub processes in the HgCommand.execEnv(). For
instance when we do a ssh based clone on windows we see plink.exe being spawned.
This is a known issue and we will need to see if we can workaround it. We should be able to on Unix, but may not be able
to on Windows, because "Windows does not maintain parent-child relationships between processes":
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4770092
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4485742
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4212450

2. If we do this destroy() the Mercurial Output tab becomes broken and will not take any further output. This would need
further investigation

For now as we have fixed the "Clone Other is broken", I'd suggested dropping the priority to P3.
Comment 5 John Rice 2007-11-16 12:34:38 UTC
Created attachment 53111 [details]
Some ideas on using setCancelable()
Comment 6 John Rice 2007-11-16 15:06:11 UTC
Changing to P3 as the original broken behavior has been fixed, though we still have the issue of stray processes.
Comment 7 John Rice 2008-02-09 17:13:36 UTC
*** Issue 126979 has been marked as a duplicate of this issue. ***
Comment 8 John Rice 2008-02-09 17:13:58 UTC
Raising priority to match duplicate filed: #126979
Comment 9 John Rice 2008-02-25 10:15:15 UTC
The problem is as described above, that on Windows we will not be able to cancel the exec'ed hg call, though we should
be able to on Unix.

For now should we just not allow the cancel to be done or throw up a dialog stating that we cannot cancel the clone and
to do so the user will need to manually kill the hg process externally, giving appropriate info for Windows or Unix.
Comment 10 Peter Pis 2008-02-25 13:12:30 UTC
P3. Please provide a descriptive notification for user that it's not possible to cancel the process.
Comment 11 John Rice 2008-02-25 17:03:18 UTC
On Windows added a cancellable hook to catch when the user is trying to cancel and warn them that this is not supported
on Windows. The user can cancel the clone on Unix platforms.

When they hit the cancel x in the status bar a dialog comes up asking them if they are sure they want to cancel the
task. I cannot alter this behavior as there is no option on the Cancellable Interface for me to turn this off. When they
hit Yes then the cancellable dialog comes up warning them that they cannot cancel.

We will not be able to do anything more on Windows, due to the limitations described above already. 

changeset:   69698:764b4d277fdf
tag:         tip
user:        jrice@netbeans.org
date:        Mon Feb 25 16:52:03 2008 +0000
summary:     #121911: Notify user they cannot Cancel Clone on Windows


Mercurial Commit
----------------
#121911: Notify user they cannot Cancel Clone on Windows
Committing 3 files to repository for Mercurial:
        /export/home/jr140578/work/main_work/mercurial/src/org/netbeans/modules/mercurial/HgProgressSupport.java
        /export/home/jr140578/work/main_work/mercurial/src/org/netbeans/modules/mercurial/ui/clone/Bundle.properties
        /export/home/jr140578/work/main_work/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java
INFO: End of Commit
Comment 12 novakm 2008-03-03 11:38:12 UTC
Verified in Build 200803021202