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 137341 - Impossible to debug Filter.init()
Summary: Impossible to debug Filter.init()
Status: RESOLVED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Infrastructure (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Thuy.d Nguyen
URL:
Keywords:
: 73450 148528 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-06-16 17:21 UTC by _ gtzabari
Modified: 2009-02-19 20:59 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2008-06-16 17:21:33 UTC
dev build 200806111204

I set a breakpoint in a Servlet Filter and invoke "Debug Main Project". Netbeans always seems to skip the breakpoint.
Comment 1 Peter Pis 2008-06-16 18:01:20 UTC
Dan, could you please help with this?
Comment 2 Peter Pis 2008-06-23 09:32:07 UTC
Can't it happen that you put some invalid breakpoint? (indicated by broken icon)
Comment 3 Dan Kolar 2008-06-24 10:17:22 UTC
Itried it with (Build 200806230002) on glassfish v2 and debugger normally hit my breakpoint in doFilter() method...
Comment 4 Peter Pis 2008-06-24 10:21:12 UTC
"gtzabari", could you please provide further information? Can you provide the source code - On what line have you put
the breakpoint? 
Comment 5 _ gtzabari 2008-06-24 16:15:07 UTC
I'll reply by the end of the week. Unfortunately I'm busy with work which is due by tonight ;)
Comment 6 _ gtzabari 2008-07-24 02:41:31 UTC
Sorry it took me so long to reply. I can confirm that the latest dev build of Netbeans allows breakpoints in doFilter()
but init() will always fail. Please confirm if you see the same on your side.
Comment 7 Peter Pis 2008-08-03 22:11:25 UTC
Reassigning to debugger.
Comment 8 Martin Entlicher 2008-08-08 20:00:29 UTC
I've reproduced the behavior, breakpoints in doFilter() are hit, but in init() are not.
Even when I submit method breakpoints on all methods in the Filter implementation class, first method breakpoint is hit
on doFilter(), not on init().

From that it looks like the debugger submits the breakpoint after init() is executed. Will investigate further...
Comment 9 Martin Entlicher 2008-08-08 21:25:28 UTC
Moving to web module.

Filter.init() is called during deployment *BEFORE* debugger is started. Therefore debugger can not stop there.
nbjpdaconnect task is called cca 250ms *after* Filter.init() - "connect-debugger" target in build-impl.xml.
Comment 10 Martin Entlicher 2008-08-08 21:27:36 UTC
Not sure whether "jspdebug" is the correct component, it's basically about build-impl.xml of Web module and
deployment/debug sequence.
Comment 11 _ gtzabari 2008-09-24 04:28:04 UTC
Can someone in the web team please confirm whether the problem is in this component and whether you plan on fixing it in
6.5? Thank you :)
Comment 12 Martin Entlicher 2008-09-29 12:53:23 UTC
*** Issue 148528 has been marked as a duplicate of this issue. ***
Comment 13 _ wadechandler 2008-09-29 13:39:59 UTC
See Issue 148528 as it explains exactly how to workaround, but also that it should be possible to fix it to debug
normally whether this is jspdebug or web. 

Per:
http://wiki.netbeans.org/BugPriorityGuidelines#section-BugPriorityGuidelines-P2

I'm upping the priority. For those of us who use the debugger and know we can start the server in debug mode, connect to
it, then deploy our module and test it this is a practical workaround, so for me it wasn't such a show stopper or in my
face issue, but for a quite a number of folks I think this would be a difficult workaround without it being documented,
but then where would it be documented so they can find the solution without first spending a couple hours or more trying
to figure out the issue.
Comment 14 Petr Jiricka 2008-10-03 12:56:52 UTC
Petr H, could you please investigate? Thanks.
Comment 15 Petr Hejl 2008-10-03 14:03:53 UTC
This would need debugger to connect to server before the app is loaded. Unfortunately the deploy task performs three
actions: starts server (if needed), undeploys app (if there is the old version) and deploys the new one. The debugger
would have to connect just before the third step (otherwise it could hit breakpoints in the old app).

As the deploy code is one big chunk of tightly connected code without any reasonable test I wouldn't to fix few weeks
before the release - high probability of regressions. Anyway this issue has to be there for several releases, but
reported just twice. Plus the WA exists.

Any other opinions?
Comment 16 _ wadechandler 2008-10-03 14:57:51 UTC
Previously existing yet only mentioned twice really isn't a good thought when thinking of quality and project survival
though. What about the guy who might have run into the issue, didn't know to do what I did, spent hours trying to get it
to work, and instead picked up a different IDE? 

Not being harsh, just honest, but the health of the project is based on users, and those users perceptions dictate
whether they are users or not, and death by a 1000 needles isn't a good experience for anyone including the project and
developers, and enough workarounds and we soon have 1000 needles.

Not saying that is what you are advocating. You may just mean to let it slide to the next release and fix it, and that
is understandable, but I believe it is in everyone's best interest that it remain a P2 and be able to be fixed in the
next release instead of existing into another, and I simply point to death by 1000 needles as a good enough reason as it
affects quality, and again, not preaching, but just examining it from a realist perspective. 

What if it were the straw that broke the decision makers back in a company where NB is the main IDE, it's a large
company, and they would be willing to purchase support from Sun? That would hurt everybody.
Comment 17 Petr Hejl 2008-10-03 15:25:34 UTC
Wade,
I agree with you. I've never said it should be P3 and I've never said it shouldn't be fixed in the next release. The
thing we have to consider is: Do we want to make the major code change right now - the change that can easily introduce
P1 regressions which will be definitely more visible? Nothing more.

I understand your concerns about the guy who run into this issue and this issue should be fixed. I'm just trying to be
pragmatic - do we want to take the risk (maybe we do)? I just provided the evaluation, possible consequences and facts
about the duplicates. I even didn't say we shouldn't fix it and intentionally didn't lower the priority.

Your point about decision maker is right, but it can be applied to any bug of any priority.
Comment 18 _ wadechandler 2008-10-03 15:45:42 UTC
Sure. That is why I made it a point to say you may not even be advocating specific things, and that it is understandable
to skip this release. I agree it can be applied to any bug, just that sometimes, and again not saying anyone
specifically does it on purpose, bugs fall through the cracks when they get pushed. So, I just wanted to stress
(re-stress?) the importance of quality related issues even when a workaround exists, and the need for them to be addressed. 

Thanks for evaluating the issue by the way :-D. I should have ended my last comment with that statement. I think you and
the rest of the NB team do an outstanding job.
Comment 19 _ gtzabari 2008-10-03 16:56:54 UTC
I agree with both of you. I understand why this is unlikely to make it into 6.5, but I would appreciate you fixing it
very soon after that release because I honestly run into this use-case about once a week, needing to debug Filter.init().

In short, I would feel better about this if you set target milestone to the next release instead of "future" because
I've seen countless issues disappear into that black hole before ;)
Comment 20 Matthew Bohm 2008-11-13 03:30:47 UTC
I think this issue may be misfiled, since it is not about breakpoints set in JSP. I think the right component may be
debuggercore. Changing component to debuggercore.
Comment 21 Matthew Bohm 2008-11-13 03:37:28 UTC
Reassiging to issues@debuggercore.
Comment 22 Martin Entlicher 2008-11-13 07:20:29 UTC
Moving back.
I've already wrote that the debugger can not catch that breakpoint, since it's started too late.
Comment 23 Matthew Bohm 2008-11-18 23:53:49 UTC
<snip>
Unfortunately the deploy task performs three actions: starts server (if needed), undeploys app (if there is the old
version) and deploys the new one. The debugger would have to connect just before the third step (otherwise it could hit
breakpoints in the old app).
</snip>

phejl and/or mentlicher, could you provide more detail on how we would make this change? Is it a change we would make in
the web.core or web.debug modules? Marking incomplete.
Comment 24 Petr Hejl 2008-11-19 13:57:20 UTC
The change probably has to be made to the action itself. Look into ant script (build-imp.xml) of web project. You will
see something like this:

    <target
depends="init,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest"
description="Debug project in IDE." if="netbeans.home" name="debug">
        <nbdeploy clientUrlPart="${client.urlPart}" debugmode="true"/>
        <antcall target="connect-debugger"/>
        <antcall target="debug-display-browser"/>
        <antcall target="connect-client-debugger"/>
    </target>

You can see that debugger is connected *after* application deployment - so the debugger can't stop in init methods
(these were already executed in that time).

The nbdeploy task performs app server start (if needed), undeployment of the old version (if any) and deployment of the
new application. So you need to split the task or allow it to execute the connect target before the deployment (or at
least before starting the app - I'm not whether these two phases are clearly separated on all servers - I think they are
not :/ ). The starting point for you is *j2ee.ant* module that will quickly lead you to *j2eeserver* where you will find
the Deployment.deploy(). As you see the API is one big action. So you need this split or allow co execute the connect
debbuger task before the deployment.

This is not an easy task.
Comment 25 Matthew Bohm 2008-11-19 17:32:48 UTC
*** Issue 73450 has been marked as a duplicate of this issue. ***
Comment 26 Matthew Bohm 2008-11-26 23:22:28 UTC
Mostly a deployment issue, so assigning to Thuy.
Comment 27 Thuy.d Nguyen 2009-01-17 21:50:48 UTC
Modified the order of the tasks in the "debug" target to make sure the server is connected to a debugger before a web
app is deployed as follows:
1. Start server (if needed)
2. connect the server to a debugger
3. deploy the web app
 
changeset: http://hg.netbeans.org/main/rev/e6c579d13c90