Bug 356400 - XML Content outline blocks Structured Editor (WebPage/XHTML/HTML/JSP editors) while retrieving DTDs using a wrong addresses or public Ids
Summary: XML Content outline blocks Structured Editor (WebPage/XHTML/HTML/JSP editors)...
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.sse (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: performance
Depends on: 365243
Blocks:
  Show dependency tree
 
Reported: 2011-08-31 15:52 EDT by Victor Rubezhny CLA
Modified: 2012-03-07 18:07 EST (History)
4 users (show)

See Also:


Attachments
patch (3.28 KB, patch)
2011-11-30 16:03 EST, Nick Sandonato CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Rubezhny CLA 2011-08-31 15:52:58 EDT
Build Identifier: I20110613-1736

XML Content Outline blocks Structured Editor for a while when retrieving the DTDs in case of wrong (not available) addresses or public IDs specified. 

For example, create a test XHTML file and paste the following content into it:
{code}
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTMLs 1.0 Transitional//EN"
    "http://hans-moleman.w3.org/TR/xhtml1/DTD/xhtml1S-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    template="layout/template.xhtml">
</ui:composition>
{code}
Right after pasting the code the WebPage editor will be blocked for a while.

Perform save and close on the editor. Try to open that file again - The eclipse will be blocked again before the editor will be opened.

Debug shows that the thread [main] is blocked by socket reading operation:

{code}
Thread [main] (Suspended)	
	SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available [native method]	
	SocketInputStream.read(byte[], int, int) line: 146	
	BufferedInputStream.fill() line: 235	
	BufferedInputStream.read1(byte[], int, int) line: 275	
	BufferedInputStream.read(byte[], int, int) line: 334	
	HttpClient.parseHTTPHeader(MessageHeader, ProgressSource, HttpURLConnection) line: 688	
	HttpClient.parseHTTP(MessageHeader, ProgressSource, HttpURLConnection) line: 633	
	HttpURLConnection.getInputStream() line: 1162	
	URIHelper.isReadableURI(String, boolean) line: 484	
	DTDParser.parse(String) line: 119	
	DTDUtil.parse(ResourceSet, String) line: 102	
	DTDImpl.buildDTDModel(String) line: 88	
	DTDImpl.buildCMDocument(String) line: 79	
	CMDocumentFactoryDTD.createCMDocument(String) line: 37	
	ContentModelManager.createCMDocument(String, String) line: 56	
	CMDocumentManagerImpl.buildCMDocument(String, String, String) line: 284	
	CMDocumentManagerImpl.loadCMDocument(String, String, String, boolean) line: 259	
	CMDocumentManagerImpl.getCMDocument(String, String, String) line: 195	
	XMLModelQueryAssociationProvider(XMLAssociationProvider).getCMDocument(String, String, String) line: 157	
	XMLModelQueryAssociationProvider(XMLAssociationProvider).getCorrespondingCMDocument(Node, boolean) line: 116	
	XMLModelQueryAssociationProvider(XMLAssociationProvider).getCMElementDeclaration(Element) line: 190	
	HTMLModelQueryImpl.getCMElementDeclaration(Element) line: 156	
	CMUtil.getElementDeclaration(Element) line: 272	
	CMUtil.getElementNamespaceURI(Element) line: 332	
	DTManager.getTagConverter(Element, int, IDOMDocument) line: 61	
	ElementEditPart.getTagConverter(Element) line: 163	
	ElementEditPart.setModel(Object) line: 84	
	HTMLEditPartsFactory.createEditPart(EditPart, Object) line: 69	
	DocumentEditPart(AbstractEditPart).createChild(Object) line: 269	
	DocumentEditPart(AbstractEditPart).refreshChildren() line: 780	
	DocumentEditPart.refreshChildren(boolean) line: 134	
	DocumentEditPart.refreshChildren() line: 126	
	DocumentEditPart(AbstractEditPart).refresh() line: 726	
	DocumentEditPart(AbstractGraphicalEditPart).refresh() line: 644	
	DocumentEditPart.refresh() line: 114	
	DocumentEditPart(AbstractEditPart).addNotify() line: 253	
	DocumentEditPart(AbstractGraphicalEditPart).addNotify() line: 223	
	DocumentEditPart(NodeEditPart).addNotify() line: 104	
	ScalableRootEditPart(AbstractEditPart).addChild(EditPart, int) line: 212	
	ScalableRootEditPart(SimpleRootEditPart).setContents(EditPart) line: 105	
	HTMLGraphicalViewer(AbstractEditPartViewer).setContents(EditPart) line: 617	
	HTMLGraphicalViewer(AbstractEditPartViewer).setContents(Object) line: 626	
	SimpleGraphicalEditor.setModel(IStructuredModel) line: 425	
	HTMLEditor.connectDesignPage() line: 364	
	HTMLEditor.createPages() line: 444	
	HTMLEditor(MultiPageEditorPart).createPartControl(Composite) line: 348	
	EditorReference.createPartHelper() line: 670	
	EditorReference.createPart() line: 465	
	EditorReference(WorkbenchPartReference).getPart(boolean) line: 595	
	EditorReference.getEditor(boolean) line: 289	
	WorkbenchPage.busyOpenEditorBatched(IEditorInput, String, boolean, int, IMemento) line: 2945	
	WorkbenchPage.busyOpenEditor(IEditorInput, String, boolean, int, IMemento) line: 2850	
	WorkbenchPage.access$11(WorkbenchPage, IEditorInput, String, boolean, int, IMemento) line: 2842	
	WorkbenchPage$10.run() line: 2793	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	WorkbenchPage.openEditor(IEditorInput, String, boolean, int, IMemento) line: 2789	
	WorkbenchPage.openEditor(IEditorInput, String, boolean, int) line: 2773	
	OpenWithMenu.openEditor(IEditorDescriptor, boolean) line: 331	
	OpenWithMenu$2.handleEvent(Event) line: 179	
	EventTable.sendEvent(Event) line: 84	
	MenuItem(Widget).sendEvent(Event) line: 1258	
	Display.runDeferredEvents() line: 3588	
	Display.readAndDispatch() line: 3209	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2696	
	Workbench.runUI() line: 2660	
	Workbench.access$4(Workbench) line: 2494	
	Workbench$7.run() line: 674	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 667	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 123	
	EclipseAppHandle.run(Object) line: 196	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 344	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
	Method.invoke(Object, Object...) line: 616	
	Main.invokeFramework(String[], URL[]) line: 622	
	Main.basicRun(String[]) line: 577	
	Main.run(String[]) line: 1410	
	Main.main(String[]) line: 1386	
{code}

Reproducible: Always

Steps to Reproduce:
1. Create XHTML file with the content described in details (it contains wrong public ID and address in DOCTYPE.
2. Play with Web Page Editor trying to open/edit and save the text to see the how editor have being blocked for a while on these operations.
Comment 1 Victor Rubezhny CLA 2011-08-31 19:12:29 EDT
The stack trace added to description shows that not only XML Content Outline blocks the editor for a while (if I'm correct the socket read timeout is the latency value). 

Here is the similar stack trace, but XML Content Outline related:

{code}
Thread [main] (Suspended)	
	SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available [native method]	
	SocketInputStream.read(byte[], int, int) line: 146	
	BufferedInputStream.fill() line: 235	
	BufferedInputStream.read1(byte[], int, int) line: 275	
	BufferedInputStream.read(byte[], int, int) line: 334	
	HttpClient.parseHTTPHeader(MessageHeader, ProgressSource, HttpURLConnection) line: 688	
	HttpClient.parseHTTP(MessageHeader, ProgressSource, HttpURLConnection) line: 633	
	HttpURLConnection.getInputStream() line: 1162	
	URIHelper.isReadableURI(String, boolean) line: 484	
	DTDParser.parse(String) line: 119	
	DTDUtil.parse(ResourceSet, String) line: 102	
	DTDImpl.buildDTDModel(String) line: 88	
	DTDImpl.buildCMDocument(String) line: 79	
	CMDocumentFactoryDTD.createCMDocument(String) line: 37	
	ContentModelManager.createCMDocument(String, String) line: 56	
	CMDocumentManagerImpl.buildCMDocument(String, String, String) line: 284	
	CMDocumentManagerImpl.loadCMDocument(String, String, String, boolean) line: 259	
	CMDocumentManagerImpl.getCMDocument(String, String, String) line: 195	
	XMLModelQueryAssociationProvider(XMLAssociationProvider).getCMDocument(String, String, String) line: 157	
	XMLModelQueryAssociationProvider(XMLAssociationProvider).getCorrespondingCMDocument(Node, boolean) line: 116	
	XMLModelQueryAssociationProvider(XMLAssociationProvider).getCMElementDeclaration(Element) line: 190	
	HTMLModelQueryImpl.getCMElementDeclaration(Element) line: 156	
	XMLContentOutlineConfiguration$AttributeShowingLabelProvider.getText(Object) line: 89	
	XMLContentOutlineConfiguration$AttributeShowingLabelProvider(ColumnLabelProvider).update(ViewerCell) line: 36	
	ColumnViewer$3(ViewerColumn).refresh(ViewerCell) line: 152	
	TreeViewer(AbstractTreeViewer).doUpdateItem(Item, Object) line: 938	
	AbstractTreeViewer$UpdateItemSafeRunnable.run() line: 106	
	SafeRunner.run(ISafeRunnable) line: 42	
	JFaceUtil$1.run(ISafeRunnable) line: 49	
	SafeRunnable.run(ISafeRunnable) line: 175	
	TreeViewer(AbstractTreeViewer).doUpdateItem(Widget, Object, boolean) line: 1018	
	StructuredViewer$UpdateItemSafeRunnable.run() line: 485	
	SafeRunner.run(ISafeRunnable) line: 42	
	JFaceUtil$1.run(ISafeRunnable) line: 49	
	SafeRunnable.run(ISafeRunnable) line: 175	
	TreeViewer(StructuredViewer).updateItem(Widget, Object) line: 2167	
	TreeViewer(AbstractTreeViewer).createTreeItem(Widget, Object, int) line: 833	
	AbstractTreeViewer$1.run() line: 808	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	TreeViewer(AbstractTreeViewer).createChildren(Widget, boolean) line: 782	
	TreeViewer.createChildren(Widget, boolean) line: 644	
	TreeViewer(AbstractTreeViewer).createChildren(Widget) line: 753	
	TreeViewer(AbstractTreeViewer).internalInitializeTree(Control) line: 1533	
	TreeViewer.internalInitializeTree(Control) line: 833	
	AbstractTreeViewer$5.run() line: 1517	
	TreeViewer(StructuredViewer).preservingSelection(Runnable, boolean) line: 1443	
	TreeViewer.preservingSelection(Runnable, boolean) line: 403	
	TreeViewer(StructuredViewer).preservingSelection(Runnable) line: 1404	
	TreeViewer(AbstractTreeViewer).inputChanged(Object, Object) line: 1510	
	TreeViewer(ContentViewer).setInput(Object) line: 280	
	TreeViewer(StructuredViewer).setInput(Object) line: 1690	
	ConfigurableContentOutlinePage.setInput(Object) line: 667	
	ConfigurableContentOutlinePage.setConfiguration(ContentOutlineConfiguration) line: 642	
	ConfigurableContentOutlinePage.createControl(Composite) line: 383	
	ContentOutline.doCreatePage(IWorkbenchPart) line: 137	
	ContentOutline(PageBookView).createPage(IWorkbenchPart) line: 408	
	ContentOutline(PageBookView).partActivated(IWorkbenchPart) line: 751	
	ContentOutline(PageBookView).showBootstrapPart() line: 920	
	ContentOutline(PageBookView).createPartControl(Composite) line: 491	
	ContentOutline.createPartControl(Composite) line: 121	
	ViewReference.createPartHelper() line: 375	
	ViewReference.createPart() line: 229	
	ViewReference(WorkbenchPartReference).getPart(boolean) line: 595	
	ViewPane(PartPane).setVisible(boolean) line: 313	
	ViewPane.setVisible(boolean) line: 534	
	PresentablePart.setVisible(boolean) line: 180	
	PresentablePartFolder.select(IPresentablePart) line: 270	
	LeftToRightTabOrder.select(IPresentablePart) line: 65	
	TabbedStackPresentation.selectPart(IPresentablePart) line: 473	
	ViewStack(PartStack).refreshPresentationSelection() line: 1245	
	ViewStack(PartStack).createControl(Composite, StackPresentation) line: 662	
	ViewStack(PartStack).createControl(Composite) line: 570	
	ViewSashContainer(PartSashContainer).createControl(Composite) line: 568	
	PerspectiveHelper.activate(Composite) line: 272	
	Perspective.onActivate() line: 981	
	WorkbenchPage.onActivate() line: 2714	
	WorkbenchWindow$27.run() line: 3023	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	WorkbenchWindow.setActivePage(IWorkbenchPage) line: 3004	
	WorkbenchWindow$20.runWithException() line: 2290	
	WorkbenchWindow$20(StartupThreading$StartupRunnable).run() line: 31	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 135	
	Display.runAsyncMessages(boolean) line: 3563	
	Display.readAndDispatch() line: 3212	
	IDEWorkbenchAdvisor(WorkbenchAdvisor).openWindows() line: 803	
	Workbench$33.runWithException() line: 1595	
	Workbench$33(StartupThreading$StartupRunnable).run() line: 31	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 135	
	Display.runAsyncMessages(boolean) line: 3563	
	Display.readAndDispatch() line: 3212	
	Workbench.runUI() line: 2604	
	Workbench.access$4(Workbench) line: 2494	
	Workbench$7.run() line: 674	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 667	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 123	
	EclipseAppHandle.run(Object) line: 196	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 344	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
	Method.invoke(Object, Object...) line: 616	
	Main.invokeFramework(String[], URL[]) line: 622	
	Main.basicRun(String[]) line: 577	
	Main.run(String[]) line: 1410	
	Main.main(String[]) line: 1386	
{code}
Comment 2 Stefan Larsson CLA 2011-09-11 04:34:04 EDT
Looks like W3C got fed up with excessive fetching of DTDs and schemas consuming their bandwidth, see
http://www.w3.org/blog/systeam/2008/02/08/w3c_s_excessive_dtd_traffic/

By the way hans-moleman.w3.org has the same IP address as www.w3.org.

The references are URIs, not URLs. If I now try to load a link like the XHTML DTD at http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd using my web browser or wget, it loads really slow, looks like they inserted an artificial 30s delay to anything matching http://www.w3.org/TR/**/*.dtd

Would be nice if the various eclipse validators would stop following the URI references, especially if it's one of a document already in Eclipse's XML catalog, or at least cached the "404 Not Found" responses.
Comment 3 Natalia Bartol CLA 2011-11-07 05:43:42 EST
This issue causes validation freezing for a long time for a HTML file that contains:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

Maybe at least URI references could be followed in an asynchronous job, so it won't block the editor?
Comment 4 Nick Sandonato CLA 2011-11-30 16:03:11 EST
Created attachment 207760 [details]
patch
Comment 5 Nick Sandonato CLA 2012-03-07 18:07:20 EST
Code released.