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 244929 - Profiler always fails with "Timed out trying to establish connection with client"
Summary: Profiler always fails with "Timed out trying to establish connection with cli...
Status: VERIFIED WORKSFORME
Alias: None
Product: profiler
Classification: Unclassified
Component: Ide (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P2 normal with 1 vote (vote)
Assignee: issues@profiler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-06 17:31 UTC by _ gtzabari
Modified: 2015-06-18 03:56 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Maven profiler log (165.38 KB, text/plain)
2014-06-06 17:31 UTC, _ gtzabari
Details
.npss file attached from NetBeans (610.97 KB, application/x-npss)
2014-06-15 21:11 UTC, _ gtzabari
Details
Testcase (2.16 KB, application/octet-stream)
2014-08-19 14:50 UTC, _ gtzabari
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2014-06-06 17:31:02 UTC
Created attachment 147597 [details]
Maven profiler log

Product Version: NetBeans IDE Dev (Build 201405310001)
Java: 1.8.0_05; Java HotSpot(TM) 64-Bit Server VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (nb)
User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev

I can launch a "Quick" profiler session just fine, but when I select Advanced (instrumented) profiling I get the attached exception. Two seconds later I get a pop-up dialog "Connecting to target VM..." which never goes away.

This is reproducible 100% of the time and I believe it's a recent regression (though I don't remember when it used to work).
Comment 1 _ gtzabari 2014-06-06 17:37:14 UTC
I think there is a performance problem at play.

Repro steps:

1. Create a new Maven project with a single class:

public class Main {

    public static void main(String[] args) {
        System.out.println("Success!!");
    }
}

2. Run Profile Project -> Advanced
3. Notice it takes 5-7 seconds for the Agent to connect.

My theory is that for a real-life project, it's really taking over 10 seconds to connect but by then the Agent gives up. Any idea why it's taking so long?
Comment 2 _ gtzabari 2014-06-06 17:50:28 UTC
Confirmed. Performance is the problem.

I added the "-J-Dprofiler.agent.connect.timeout=60" command-line option and sure enough, 25 seconds after the agent is launched the debugging session begins.

Now we need to establish why it's taking a whopping 25 seconds to start the session.

I am running on Windows 7, 64-bit, JDK 8 update 5, on a i7 950 CPU with 24GB ram. While the agent is starting up, only 50% of one core is in use so I'm not sure what the bottleneck could be.

Time to profile the profiler? :)
Comment 3 Tomas Stupka 2014-06-13 11:35:29 UTC
please profile the IDE while trying to profile your app and attach the snapshot
Comment 4 _ gtzabari 2014-06-15 21:11:56 UTC
Created attachment 147687 [details]
.npss file attached from NetBeans

.npss file
Comment 5 _ gtzabari 2014-06-15 21:12:32 UTC
Thomas,

Done. Take a look at the snapshot and let me know what you find.
Comment 6 Tomas Stupka 2014-06-18 14:54:59 UTC
looks like profiler needs some time until it attaches to the running agent. Please evaluate ...
Comment 7 Tomas Hurka 2014-07-24 10:37:28 UTC
Is there a way to provide reproducible test case? Thanks.
Comment 8 Tomas Hurka 2014-07-30 08:28:39 UTC
To investigate this issue we need reproducible test-case. Thanks.
Comment 9 _ gtzabari 2014-08-19 14:50:35 UTC
Product Version: NetBeans IDE Dev (Build 201408170001)
Java: 1.8.0_11; Java HotSpot(TM) 64-Bit Server VM 25.11-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_11-b12
System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (nb)
User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev

Repro steps:

1. Open issue244929.zip (will attach in a moment)
2. Click Profile Project icon
3. Select Advanced
4. Click Run
5. 8 seconds elapses and an error dialog pops up "Redefinition failed with error 62". Click "Okay". Testcase will run.

The error message seems like a secondary bug. The primary thing to notice is that it takes 8 seconds (from the moment Netbeans prints "Profiler Agent: Waiting for connection") to launch this minimal testcase.

Non-trivial projects (consisting of more classes) take slightly longer to load, which pushes them over the 10 second limit.
Comment 10 _ gtzabari 2014-08-19 14:50:56 UTC
Created attachment 148770 [details]
Testcase
Comment 11 Tomas Hurka 2014-08-19 16:10:24 UTC
"Redefinition failed with error 62" is caused by JDK bug in JDK 8u11 (issue #245522). Can you please try older version of JDK to see how this example really works. Thanks.
Comment 12 _ gtzabari 2014-08-19 21:36:40 UTC
Tomas,

The "error 62" problem goes away with JDK 8 update 5 but the original problem remains (attaching the profiler takes too long).

Something is running in the beginning which is taking too long. It takes 6-8 seconds for a simple Hello World program and 25 seconds for an application with 150,000 lines of code.

I am expecting you to improve this performance and/or come up with a more reasonable way to handle longer timeouts (progress bar with a default timeout that is longer than 10 seconds).
Comment 13 Tomas Hurka 2015-06-17 13:34:34 UTC
I am not able to reproduce it with latest dev. build with attached test project. It takes under a second from the moment Netbeans prints "Profiler Agent: Waiting for connection" to launch the test application.
Comment 14 _ gtzabari 2015-06-18 03:56:46 UTC
Verified as WORKSFORME in build 201506110001.