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 62812

Summary: Cannot cancel commands
Product: versioncontrol Reporter: Jesse Glick <jglick>
Component: CVSAssignee: issues@versioncontrol <issues>
Status: RESOLVED FIXED    
Severity: blocker CC: pholthuizen
Priority: P3 Keywords: THREAD
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Thread dumps: go on SWAN, try to refresh status of prj w/ No Proxy, kill -QUIT, try to Cancel a couple of times, kill -QUIT again

Description Jesse Glick 2005-08-22 20:37:44 UTC
050822, Mustang, Linux. I opened a source file and chose CVS -> Show XXX.java
Annotations. It began running but did not finish. (Probably the proxy setting
was wrong, but javacvs seems to ignore the proxy configuration that the rest of
the IDE uses, and I cannot find any place to tell it to use a proxy right now -
I go on and off SWAN frequently, often with the IDE running.)

Anyway, seeing that it was not going to work (and after getting the answer I
wanted from the command line), I right-clicked on the process in the status bar
and chose Cancel. But nothing happened, even after multiple attempts. Nothing
relevant-looking in messages.log.
Comment 1 Jesse Glick 2005-08-22 20:41:44 UTC
Note: several minutes later, the operation did time out and ask me for my proxy
settings.
Comment 2 _ pkuzel 2005-08-24 13:30:52 UTC
CommandRunnable.cancel():

        client.abort();        
        runnableThread.interrupt();

Could you provide thread dump please? I suspect that interrupt() does not work
for direct socket implementation. It should raise InterruptedIOException.


Besides one coumpound progress should be used here instead of two atomic.
Comment 3 Jesse Glick 2005-08-24 14:20:13 UTC
Created attachment 24184 [details]
Thread dumps: go on SWAN, try to refresh status of prj w/ No Proxy, kill -QUIT, try to Cancel a couple of times, kill -QUIT again
Comment 4 _ pkuzel 2005-08-24 16:11:42 UTC
I was able to trigger following one that is not interruptible:

"Wizard Background Validation" daemon prio=1 tid=0x5a08b138 nid=0x268f runnable
[0x5a601000..0x5a601700]
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        - locked <0x459cb9e0> (a java.net.SocksSocketImpl)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
        at java.net.Socket.connect(Socket.java:507)
        at java.net.Socket.connect(Socket.java:457)
        at java.net.Socket.<init>(Socket.java:365)
        at java.net.Socket.<init>(Socket.java:178)
        at javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:196)
        at
org.netbeans.lib.cvsclient.connection.PServerConnection.openConnection(PServerConnection.java:186)
        at
org.netbeans.lib.cvsclient.connection.PServerConnection.verify(PServerConnection.java:293)
        at
org.netbeans.modules.versioning.system.cvss.ui.wizards.RepositoryStep.validateBeforeNext(RepositoryStep.java:232)
        at
org.netbeans.modules.versioning.system.cvss.ui.wizards.AbstractStep.validate(AbstractStep.java:113)
Comment 5 _ pkuzel 2005-08-24 16:46:53 UTC
All traces share uninterruptible blocking call to
java.net.PlainSocketImpl.socketConnect(Native Method).

RFE 6315293 on Java 6.
Comment 6 Jesse Glick 2005-08-24 18:11:31 UTC
Possible workaround: post the Socket.connect to a new separate thread, then
join() on it. Now the main task thread can be interrupted. If so, the call to
connect will just continue in the background until it times out (or succeeds),
but this won't matter much. You can probably also have the connection be closed
if it did eventually succeed but the task thread was interrupted.
Comment 7 _ pkuzel 2005-09-19 17:23:12 UTC
*** Issue 64673 has been marked as a duplicate of this issue. ***
Comment 8 pholthuizen 2005-09-25 19:26:31 UTC
After a bit of searching I found the next classes within the projects "CVS
Client Library" and "CVS Versioning System" using SocketFactory.createSocket:
- org.netbeans.lib.cvsclient.connection.PServerConnection
- org.netbeans.modules.versioning.system.cvss.SSHConnection
- org.netbeans.modules.versioning.system.cvss.RepositoryStep

The next classes use Connection.open:
- org.netbeans.lib.cvsclient.Client
- org.netbeans.lib.cvsclient.commandLine.CVSCommand
- org.netbeans.modules.versioning.system.cvss.SSHConnection

I hope this helps making the scope of the problem domain clear.

Sincerely,
Patrick Holthuizen
Comment 9 _ pkuzel 2005-09-26 12:45:29 UTC
I'll follow new separate thread proposal.
Comment 10 _ pkuzel 2005-09-26 13:36:58 UTC
FIXED

Note: some information execeptions logged.