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 146762 - Deadlock after reformat jsp file
Summary: Deadlock after reformat jsp file
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP Parser (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: issues@javaee
URL:
Keywords:
: 140361 146990 147039 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-09-10 12:13 UTC by josin
Modified: 2015-09-17 13:09 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Thread dump (26.27 KB, text/plain)
2008-09-10 12:14 UTC, josin
Details
Thread dump (26.27 KB, text/plain)
2008-09-10 12:15 UTC, josin
Details
NB messages log (46.30 KB, text/plain)
2008-09-10 12:16 UTC, josin
Details
Patch - temporary solution (840 bytes, patch)
2008-09-11 13:46 UTC, Dusan Balek
Details | Diff
Thread dump (26.05 KB, text/plain)
2008-09-12 10:55 UTC, josin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description josin 2008-09-10 12:13:00 UTC
Steps to reproduce:
1. Create new Web Application with JSF
2. In welcomeJSF file just hit enter and insert some easy tag, ex. <span></span>
3. Invoke pop-up and hit Format.

Found in:
Product Version: NetBeans IDE Dev (Build 200809100201)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)

NB log and thread dump is attached.
Comment 1 josin 2008-09-10 12:14:28 UTC
Created attachment 69515 [details]
Thread dump
Comment 2 josin 2008-09-10 12:15:22 UTC
Created attachment 69516 [details]
Thread dump
Comment 3 josin 2008-09-10 12:16:33 UTC
Created attachment 69518 [details]
NB messages log
Comment 4 Marek Fukala 2008-09-10 13:09:55 UTC
Caused by recent changes in SimplifiedJSPServlet - now it requests *not cached* parser data from EDT so the calling
thread waits for the jsp background parsing thread to finish and provide fresh parse data. 

The problem is that the SimplifiedJSPServlet is called under document atomic lock and the background parsing thread
needs to get the editor content. So the editor kit is requested to save its content to a stream which required document
readlock => EDT - JSP Background Parsing deadlock.

The solution would be not to call the TaglibParseSupport.getCachedParseResult(xx, yy, true(force parser)) under document
atomic/writelock. This however doesn't look so easy to do so I'll create a new method in JspSyntaxSupport which will
return the same data as the currently used one but will not require the fresh parse data.
Comment 5 Marek Fukala 2008-09-10 13:42:23 UTC
fixed the particular case by the proposed way. I'll keep the issue opened so we can track it - one may still access the
parser under document writelock and cause the lockup. I would at least recommed to add a notice into the api methods and
possibly some assert for the document not being atomiclocked if the 'force parse' and 'use editor' options are used.

Technically it is not jspparser issue, but changing the component to it since it is the IMO the most fitting
subcomponent. I tmysik thinks this is not his issue, reassign back to me (jsp/core). Thanks.

changeset:   101170:83c15cc6fe47
tag:         tip
user:        Marek Fukala <mfukala@netbeans.org>
date:        Wed Sep 10 14:39:15 2008 +0200
summary:     #146762 - Deadlock after reformat jsp file
Comment 6 josin 2008-09-10 13:51:28 UTC
Reproducible deadlock with data lost (http://wiki.netbeans.org/BugPriorityGuidelines).
Comment 7 Marek Fukala 2008-09-10 14:08:51 UTC
It is fixed for you josin, have you read the comment? :-). Revision 83c15cc6fe47. I kept it opened (even there is no
deadlock anymore) to track the remaining API issues.
Comment 8 josin 2008-09-10 14:22:16 UTC
I'm very sorry, it's my fault :(
Comment 9 Marek Fukala 2008-09-10 14:23:54 UTC
Do not worry, I am glad you reported the problem!
Comment 10 Marek Fukala 2008-09-11 11:56:55 UTC
The fix wasn't complete. There deadlock can still occur in theory if the SimplifiedJSPServlet asks for the parse data
before the file was parsed at least once.

I'll try to figure out how to avoid this...

changeset:   101430:5be790669a1e
tag:         tip
user:        Marek Fukala <mfukala@netbeans.org>
date:        Thu Sep 11 12:52:58 2008 +0200
summary:     additional fix to issue #146762 - Deadlock after reformat jsp file
Comment 11 Marek Fukala 2008-09-11 13:19:50 UTC
According to Dusan Balek, there has been a change in the java source parsing recently. Now the parsing is not done in
the reformat lock, but directly inside the atomic lock. Dusan promised to create a jsp specific patch which will use the
previous logic.

Proper fix should be done in next netbeans version my migrating the jsp parser to the parsing api.
Comment 12 Dusan Balek 2008-09-11 13:46:15 UTC
Created attachment 69655 [details]
Patch - temporary solution
Comment 13 Quality Engineering 2008-09-11 17:35:20 UTC
Integrated into 'main-golden', will be available in build *200809111401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/83c15cc6fe47
User: Marek Fukala <mfukala@netbeans.org>
Log: #146762 - Deadlock after reformat jsp file
Comment 14 Marek Fukala 2008-09-12 08:33:42 UTC
*** Issue 146990 has been marked as a duplicate of this issue. ***
Comment 15 josin 2008-09-12 10:54:24 UTC
I'm sorry but deadlock is still reproducible in 200809120201. P1 till next fix. I'll attach a new thread dump.
Comment 16 josin 2008-09-12 10:54:31 UTC
I'm sorry but deadlock is still reproducible in 200809120201. P1 till next fix. I'll attach a new thread dump.
Comment 17 josin 2008-09-12 10:55:09 UTC
Created attachment 69734 [details]
Thread dump
Comment 18 Marek Fukala 2008-09-12 13:43:40 UTC
I tried the patch Dusane but the reformatting of java code inside JSP doesn't work then. Can you please look at it?
Comment 19 Marek Fukala 2008-09-12 17:35:16 UTC
As for the additional fix to issue #146762 - Deadlock after reformat jsp file, I am affraid it wasn't pushed :-(.

Can you please verify in a build with this change? Thanks.

http://hg.netbeans.org/main/rev/5be790669a1e
Comment 20 Quality Engineering 2008-09-13 05:22:01 UTC
Integrated into 'main-golden', will be available in build *200809130201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/5be790669a1e
User: Marek Fukala <mfukala@netbeans.org>
Log: additional fix to issue #146762 - Deadlock after reformat jsp file
Comment 21 josin 2008-09-15 08:17:52 UTC
Works fine. P1 verified. I keep it open as P3 for tracking remaining API issues.

Product Version: NetBeans IDE Dev (Build 200809150201)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)
Comment 22 Marek Fukala 2008-09-15 10:31:57 UTC
*** Issue 147039 has been marked as a duplicate of this issue. ***
Comment 23 Marek Fukala 2008-09-24 15:32:32 UTC
*** Issue 138941 has been marked as a duplicate of this issue. ***
Comment 24 Marek Fukala 2008-09-24 15:33:00 UTC
*** Issue 140361 has been marked as a duplicate of this issue. ***
Comment 25 Martin Balin 2015-09-17 13:09:43 UTC
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.