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 199655 - Starting a JavaEE (ANT) project in profiling mode takes really long time (1-2 minutes)
Summary: Starting a JavaEE (ANT) project in profiling mode takes really long time (1-2...
Status: VERIFIED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Infrastructure (show other bugs)
Version: 7.0
Hardware: PC Linux
: P2 normal (vote)
Assignee: Vince Kraemer
URL: http://netbeans.org/bugzilla/show_bug...
Keywords:
: 197213 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-06-23 13:15 UTC by J Bachorik
Modified: 2011-11-18 11:07 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Proposed patch (5.65 KB, patch)
2011-06-23 13:19 UTC, J Bachorik
Details | Diff
the patch I'm happy with (5.95 KB, patch)
2011-09-14 12:32 UTC, Petr Hejl
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description J Bachorik 2011-06-23 13:15:47 UTC
When profiling a JavaEE project the server startup takes cca. 1-2 minutes even for the simplest projects. First, I thought it wasn't working at all - I only realized it did when I left the IDE be and went on to do something else.

It is easy to reproduce:
1. Create a sample project - eg. "Serlvet Stateless" from Java Web samples
2. Make sure the target server is GlassFish 3
3. Profile the project
4. The server startup gets blocked for cca. 1.5 minutes


I came to realize that this problem was introduced while attempting to fix #195441. The fix tries to resolve the problem of prematurely deploying applications to the profiled server when it is not ready by employing additional checks for the server state - unfortunately in a way that prevents the server to reach the desired state. 
In an ant based project ahe checks are invoked before the profiler client connects to the profiler agent (piggybacked on the server) and allows the target JVM to continue - as such the server stays blocked, the checks stay blocked and the whole system basically waits for the checks to time out.

In a maven based project the server startup and the profiler attach are performed concurrently and as such not causing any lock ups.
Comment 1 J Bachorik 2011-06-23 13:19:32 UTC
Created attachment 109081 [details]
Proposed patch

I am attaching a proposed patch. It is not in the server plugin area, per se, but it does solve both of the problems. 

The patch makes sure that when deploying to a server in profiling mode the server will be in a desired state before trying to run the deploy operation. The changes are localized only to the profiling specific part so they don't affect the rest of the deployment process.
Comment 2 Petr Jiricka 2011-06-23 14:22:29 UTC
Cc Petr Hejl for the j2eeserver part.
Comment 3 Vince Kraemer 2011-06-30 23:39:49 UTC
I get a 1 minute pause, too.  Since the start-up does complete and the profiler attaches, I am not eager to change this for 7.0.1... since we do not have a lot of time to see what other fall-out there may be.

Targeting to 7.1
Comment 4 J Bachorik 2011-07-04 08:50:02 UTC
*** Bug 197213 has been marked as a duplicate of this bug. ***
Comment 5 Vince Kraemer 2011-07-05 23:55:20 UTC
PetrH: this looks like a rollback of some changes I made in the GF plugin and a more significant change in j2eeserver... Please evaluate.
Comment 6 Petr Hejl 2011-07-19 15:08:17 UTC
From j2eeserver perspective I would rather see CountDownLatch as the code in the patch is hard to read and does not prevent spurious wakeups. I would also put remove listener code to finally block.
Comment 7 J Bachorik 2011-08-02 08:24:22 UTC
I am fine with whatever fix that works. The patch was just a proposal which scratched my itch.
Comment 8 Petr Hejl 2011-09-14 12:32:51 UTC
Created attachment 110747 [details]
the patch I'm happy with

The patch with fixed java EE part.
Comment 9 Petr Hejl 2011-09-14 12:34:58 UTC
I attached the patch I like (the Java EE part). I'm not sure about the GF part. Once this is cleared feel free to apply the patch.
Comment 10 Quality Engineering 2011-09-17 14:15:55 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/31982c6873c2
User: vince kraemer <vkraemer@netbeans.org>
Log: #199655 : prevent long start-up delay for ant-based Java EE projets
Comment 11 Vince Kraemer 2011-09-18 16:18:59 UTC
in the build
Comment 12 Petr Cyhelsky 2011-11-18 11:07:49 UTC
verified, it no longer takes that much time, but it still doesn't feel very snappy either