Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 283629 - pasting a stack trace into a new comment block in the task editor can hang eclipse
Summary: pasting a stack trace into a new comment block in the task editor can hang ec...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P1 major (vote)
Target Milestone: 1.1.2   Edit
Assignee: David Green CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 284154 284210 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-07-15 15:48 EDT by David Green CLA
Modified: 2011-01-06 10:01 EST (History)
5 users (show)

See Also:


Attachments
trace of the hung thread, from the debug view (12.51 KB, text/plain)
2009-07-15 15:48 EDT, David Green CLA
no flags Details
stack trace that, when pasted, causes the hang (3.72 KB, text/plain)
2009-07-15 15:49 EDT, David Green CLA
no flags Details
JUnit test case that reproduces the problem. (1.48 KB, patch)
2009-07-15 15:56 EDT, David Green CLA
no flags Details | Diff
mylyn/context/zip (6.89 KB, application/octet-stream)
2009-07-15 15:56 EDT, David Green CLA
no flags Details
patch that fixes the issue (3.02 KB, patch)
2009-07-15 19:50 EDT, David Green CLA
no flags Details | Diff
mylyn/context/zip (42.35 KB, application/octet-stream)
2009-07-15 19:50 EDT, David Green CLA
no flags Details
patch that disables parsing of stack traces (1.05 KB, patch)
2009-07-20 14:22 EDT, Steffen Pingel CLA
no flags Details | Diff
patch that disables test cases (3.81 KB, patch)
2009-07-22 08:29 EDT, Steffen Pingel CLA
no flags Details | Diff
patch that fixes the hang and enables JUnit tests (5.44 KB, patch)
2009-08-12 20:39 EDT, David Green CLA
no flags Details | Diff
mylyn/context/zip (43.53 KB, application/octet-stream)
2009-08-12 20:39 EDT, David Green CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Green CLA 2009-07-15 15:48:01 EDT
To reproduce:

# copy the attached stack trace to the clipboard
# open any Bugzilla task in the Mylyn task editor (markup enabled)
# paste into the new comment part
# observe that Eclipse hangs and never comes back

The stack trace of the hung thread is also attached.  
Might be related to bug 264345.
Comment 1 David Green CLA 2009-07-15 15:48:43 EDT
Created attachment 141700 [details]
trace of the hung thread, from the debug view
Comment 2 David Green CLA 2009-07-15 15:49:13 EDT
Created attachment 141701 [details]
stack trace that, when pasted, causes the hang
Comment 3 David Green CLA 2009-07-15 15:52:46 EDT
The line of text being processed at JavaStackTraceBlock.java:50 is 'org.eclipse.ui.internal.PerspectiveBarContributionItem.select(PerspectiveBarContributionItem.java:124)'
Comment 4 David Green CLA 2009-07-15 15:56:45 EDT
Created attachment 141702 [details]
JUnit test case that reproduces the problem.
Comment 5 David Green CLA 2009-07-15 15:56:46 EDT
Created attachment 141703 [details]
mylyn/context/zip
Comment 6 David Green CLA 2009-07-15 19:50:35 EDT
Created attachment 141726 [details]
patch that fixes the issue
Comment 7 David Green CLA 2009-07-15 19:50:40 EDT
Created attachment 141727 [details]
mylyn/context/zip
Comment 8 David Green CLA 2009-07-16 13:25:19 EDT
Fixed for 3.2.1
Comment 9 Leo Dos Santos CLA 2009-07-20 13:37:27 EDT
I was going through my queries this morning, when my workspace locked up trying to view a bug. Running 'kill -3' produced a stack for thread-0 that looks a lot like the one in the first attachment. It appears that I can reliably reproduce the hang trying to open bug 284002
Comment 10 Leo Dos Santos CLA 2009-07-20 13:42:40 EDT
I should note that I'm up to do with the latest sources.
Comment 11 Leo Dos Santos CLA 2009-07-20 13:43:32 EDT
*up to date* with the latest sources, sorry.
Comment 12 Steffen Pingel CLA 2009-07-20 14:04:13 EDT
I can confirm that this is still happening.
Comment 13 Steffen Pingel CLA 2009-07-20 14:22:54 EDT
Created attachment 142060 [details]
patch that disables parsing of stack traces

Since the effects of this bug are severe I would like to get this fixed for the 3.2.1 release. Unfortunately this bug report does not have any information about the cause of the problem which had already been partially fixed. Therefore I am not able to debug and fix this properly in time for the release but have attached a patch to disable parsing of stack traces as a stopgap solution. 

David, please let me know if you have time to work on a fix until tomorrow. I will commit my patch otherwise.
Comment 14 Steffen Pingel CLA 2009-07-21 12:56:42 EDT
I have committed the patch which disables decoration of stack traces and avoids the busy loop. Leo, can you verify?
Comment 15 Leo Dos Santos CLA 2009-07-21 14:24:51 EDT
Yes, that relieves the blocker status for me.
Comment 16 Steffen Pingel CLA 2009-07-22 08:29:29 EDT
Created attachment 142255 [details]
patch that disables test cases
Comment 17 David Green CLA 2009-08-12 20:39:43 EDT
Created attachment 144325 [details]
patch that fixes the hang and enables JUnit tests

I've got a candidate fix for this issue that causes WikiText to detect stack traces without the dreaded hang.

Anyone that's interested should try the patch and open bugs containing stack traces to determine if they are correctly detected and if the UI remains responsive.
Comment 18 David Green CLA 2009-08-12 20:39:48 EDT
Created attachment 144326 [details]
mylyn/context/zip
Comment 19 Steffen Pingel CLA 2009-08-12 22:14:54 EDT
I have applied the patch to my workspace and will see how it goes. Shawn, Rob, Leo, can you do the same?

David, do you have any better clue to why this is happening at all?
Comment 20 David Green CLA 2009-08-12 22:42:45 EDT
(In reply to comment #19)
> David, do you have any better clue to why this is happening at all?

Looks to me like the problem part of the regex is as follows: @([A-Za-z][a-z0-9_$]*)+@
Notice how two very similar repeating segments are nested?  Though it _shouldn't_ loop infinitely, you can see why it may involve many, many computations (exponentially more expensive, depending on the string it's trying to match).  The patch changes the problem part as follows: @[A-Za-z][a-zA-Z0-9_$]*@
So while I'd like to blame the regex runtime, I can't really do it with a straight face... looks to me like a lesson in how to write a regex.  I may have to blog about this one...
Comment 21 David Green CLA 2009-08-12 22:44:27 EDT
Ack... should have previewed the markup before displaying it.  Here are the two regex segments:

old: ==<code>([A-Za-z][a-z0-9_$]*)+</code>==
new: ==<code>[A-Za-z][a-zA-Z0-9_$]*</code>==
Comment 22 David Green CLA 2009-08-13 13:14:49 EDT
patch applied to head
reassigning to Steffen to apply the patch to the branch
Comment 23 Leo Dos Santos CLA 2009-08-13 13:17:58 EDT
(In reply to comment #19)
> I have applied the patch to my workspace and will see how it goes. Shawn, Rob,
> Leo, can you do the same?
> 
> David, do you have any better clue to why this is happening at all?

This patch fixes the problem I was running into. Great!
Comment 24 Steffen Pingel CLA 2009-08-13 15:22:29 EDT
Patch applied to m_3_2_x branch. I'll trigger a new weekly build.
Comment 25 David Green CLA 2009-08-14 17:00:26 EDT
(In reply to comment #23)
> This patch fixes the problem I was running into. Great!

(In reply to comment #24)
> Patch applied to m_3_2_x branch. I'll trigger a new weekly build.

resolved as per above comments
Comment 26 David Green CLA 2009-09-03 14:02:17 EDT
*** Bug 284210 has been marked as a duplicate of this bug. ***
Comment 27 David Green CLA 2009-09-03 14:05:40 EDT
*** Bug 284154 has been marked as a duplicate of this bug. ***