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 256151 - Freeze after remote disconnection
Summary: Freeze after remote disconnection
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Remote (show other bugs)
Version: 8.1
Hardware: PC Windows 10 x64
: P2 normal (vote)
Assignee: Vladimir Kvashin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-24 14:47 UTC by pompex
Modified: 2016-02-02 15:52 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
jstack (21.42 KB, text/plain)
2015-10-24 20:16 UTC, soldatov
Details
Proposed fix (1.83 KB, patch)
2015-11-17 14:55 UTC, Vladimir Kvashin
Details | Diff
java thread dump (32.04 KB, text/plain)
2015-12-22 15:14 UTC, Alexander Pepin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pompex 2015-10-24 14:47:39 UTC
--------
Product Version: NetBeans IDE 8.1 RC2 (Build 201510122201)
Java: 1.8.0_51; Java HotSpot(TM) 64-Bit Server VM 25.51-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_51-b16
System: Windows 8 version 6.2 running on amd64; Cp1250; pl_PL (nb)
--------

When a conenction between Netbeans and the remote server is being lost, it seems like Netbeans is falling into some kind of infinite loop - causing Netbeans to hang and use 80~% of the CPU. The only possible way to get rid of it is to kill Netbeans process as it's not going to unfreeze itself.
Comment 1 soldatov 2015-10-24 16:32:50 UTC
When the NetBeans IDE freezes or becomes sluggish for no apparent reason, it's recommended to generate a thread dump(or profile IDE) and attach as a file to the reported bug. http://wiki.netbeans.org/GenerateThreadDump
Comment 2 soldatov 2015-10-24 20:16:50 UTC
Created attachment 156954 [details]
jstack

Scenario:
- Launch some OS in VirtualBox
- Add host to NetBeans
- Create Full Remote project (Quote)
- Open cpu.cc and quote.cc files
- Shutdown virtual machine
==> big problems with IDE
Comment 3 soldatov 2015-10-24 20:39:05 UTC
In log I see infinite:
 
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/cpu.cc
FINEST [null]: Last record repeated 2 more times.
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/quote.cc
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/cpu.cc
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/quote.cc
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/cpu.cc
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/quote.cc
FINEST [null]: Last record repeated again.
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/cpu.cc
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/quote.cc
FINEST [null]: Last record repeated again.
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/cpu.cc
FINEST [null]: Last record repeated 3 more times.
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/quote.cc
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/cpu.cc
FINEST [null]: Last record repeated again.
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/quote.cc
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/cpu.cc
FINEST [remote.support.logger]: Adding notification for sova@127.0.0.1:/home/sova/NetBeansProjects/Quote_2/quote.cc
Comment 4 Vladimir Kvashin 2015-11-16 20:55:31 UTC
This is 100% reproducible.
The consequences are terrific: freezes and freezes many seconds each.

The root cause is most likely the stack

"Connection Watcher"
	at org.netbeans.modules.nativeexecution.api.util.ConnectionManager.access$900(ConnectionManager.java:88)
	at org.netbeans.modules.nativeexecution.api.util.ConnectionManager$ConnectionWatcher.run(ConnectionManager.java:845)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)

That is called zillions of time.
Comment 5 Vladimir Kvashin 2015-11-16 21:39:02 UTC
Until it is fixed, here is a workaround:
add a command line parameter
-J-Dnativeexecution.connection.watch.interval=0
Comment 6 Vladimir Kvashin 2015-11-17 14:55:16 UTC
Created attachment 157378 [details]
Proposed fix
Comment 7 Vladimir Kvashin 2015-11-17 16:34:45 UTC
enum/hg/release81/rev/6df2137dd67f
Comment 8 Quality Engineering 2015-11-24 02:31:08 UTC
Integrated into 'main-silver', will be available in build *201511240002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/df9eefbce14d
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: fixed #256151 - Freeze after remote disconnection
(transplanted from 6df2137dd67fb3a2a76fb4bb360c1bf0af4bd089)
Comment 9 Alexander Pepin 2015-12-22 15:14:03 UTC
Created attachment 157889 [details]
java thread dump
Comment 10 Alexander Pepin 2015-12-22 15:14:53 UTC
The problem still exists, see attached thread dump.
Comment 11 Vladimir Kvashin 2015-12-25 09:09:27 UTC
I failed to reproduce this.
What I did was:
  - I set up a Linux on a Virtual Box as remote host.
  - I opened a couple of projects, opened some files
  - Then I closed VBox session (closed window, selected "Saved machine state")
Everything went smoothly  in the IDE. Host became disconnected.

Alexander, could you please explain how to reproduce this?
Comment 12 Vladimir Kvashin 2016-01-19 10:52:53 UTC
I'm still failing to reproduce this. I'm going to close the issue unless Alexander (or somebody else) adds a  description of how to reproduce.
Comment 13 Alexander Pepin 2016-01-19 13:22:33 UTC
Please try the following scenario:
- create a full remote Quote sample in Virtual machine
- open quote.cc and system.cc
- press Pause in VBox toolbar
- try to switch between quote.cc and system.cc, no problem so far
- open e.g. cpu.cc, it's opened empty and it's OK and it does not bring any issues
- close cpu.cc
Result: IDE freezes. Resume Vbox.
IDE reported about detected slowness for 463s. See report:
http://statistics.netbeans.org/analytics/detail.do?id=213844
Comment 14 Vladimir Kvashin 2016-01-21 07:59:50 UTC
Alexander, thanks for the detailed description.
I was finally able to reproduce this; although in my case it hangs not at once but after some period after disconnection.

I'd like to note however that the situation differs from one described in the original bug, which reported 80% cpu consumption and had quite different reason.
Comment 15 Vladimir Kvashin 2016-01-26 09:26:55 UTC
"Sleep" is a strange VM state; the connection does not break when VM goes into sleep mode, but sure you never get a response.

Below is just an implementation-wise investigation. While loading current editor content refresh was called on file object. This makes remoteFS send a request to fs_server and wait for an answer. Connection is not broken, so it thinks it is connected; request is written OK and then it is waits for response... waits forever.


"org.openide.text Document Processing" #121 daemon prio=1 os_prio=-2 tid=0x000000005a0d4000 nid=0xfcc4 in Object.wait() [0x0000000066eae000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:502)
	at org.netbeans.modules.remote.impl.fs.server.FSSResponse.getNextPackage(FSSResponse.java:148)
	- locked <0x00000000fc10db08> (a java.lang.Object)
	at org.netbeans.modules.remote.impl.fs.server.FSSResponse.getNextPackage(FSSResponse.java:136)
	at org.netbeans.modules.remote.impl.fs.server.FSSTransport.stat_or_lstat(FSSTransport.java:154)
	at org.netbeans.modules.remote.impl.fs.server.FSSTransport.lstat(FSSTransport.java:134)
	at org.netbeans.modules.remote.impl.fs.RemoteFileSystemTransport.lstat(RemoteFileSystemTransport.java:185)
	at org.netbeans.modules.remote.impl.fs.RemotePlainFile.refreshImpl(RemotePlainFile.java:479)
	at org.netbeans.modules.remote.impl.fs.RemoteDirectory.ensureChildSync(RemoteDirectory.java:1558)
	at org.netbeans.modules.remote.impl.fs.RemotePlainFile.getInputStream(RemotePlainFile.java:362)
	at org.netbeans.modules.remote.impl.fs.RemoteFileObject.getInputStream(RemoteFileObject.java:393)
	at org.openide.text.DataEditorSupport$Env.inputStream(DataEditorSupport.java:893)
	at org.openide.text.DocumentOpenClose$DocumentLoad.atomicLockedRun(DocumentOpenClose.java:761)
	at org.openide.text.DocumentOpenClose$DocumentLoad.run(DocumentOpenClose.java:615)
	at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:323)
	at org.openide.text.NbDocument.runAtomic(NbDocument.java:436)
	at org.openide.text.DocumentOpenClose$DocumentLoad.run(DocumentOpenClose.java:655)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
Comment 16 Vladimir Kvashin 2016-01-28 10:30:59 UTC
Fixed on enum
4b43e2fa54d3
d5940d7755ef
Comment 17 Quality Engineering 2016-01-29 02:37:43 UTC
Integrated into 'main-silver', will be available in build *201601290002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/0bacf28ba780
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: fixing #256151 - Freeze after remote disconnection
(transplanted from 4ee203dc7cab40f692465be8553c141f790653c6)
Comment 19 Alexander Pepin 2016-02-02 15:52:17 UTC
Verified in build 20160130.