Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 369648 - IndexOutOfBoundsException caused by concurrent threads should be caught in PHPSelectionEngine
Summary: IndexOutOfBoundsException caused by concurrent threads should be caught in PH...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP UI CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-25 07:42 EST by Natalia Bartol CLA
Modified: 2020-05-14 11:36 EDT (History)
3 users (show)

See Also:


Attachments
IndexOutOfBoundsException caught in PHPSelectionEngine - patch (1.50 KB, patch)
2012-01-25 07:56 EST, Natalia Bartol CLA
jacek.pospychala: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Natalia Bartol CLA 2012-01-25 07:42:54 EST
Build Identifier: 

Background thread may read source model at the same time when main thread modifies it. This may cause ArrayIndexOutOfBoundsException or StringIndexOutOfBoundsException. 

!ENTRY org.eclipse.php.core 4 10001 2012-01-24 17:12:32.919
!MESSAGE PHPCore plugin internal error
!STACK 0
java.lang.StringIndexOutOfBoundsException: String index out of range: 967786
	at java.lang.String.charAt(String.java:686)
	at org.eclipse.php.internal.core.util.text.PHPTextSequenceUtilities.readIdentifierStartIndex(PHPTextSequenceUtilities.java:375)
	at org.eclipse.php.internal.core.codeassist.PHPSelectionEngine.internalASTResolve(PHPSelectionEngine.java:234)
	at org.eclipse.php.internal.core.codeassist.PHPSelectionEngine.select(PHPSelectionEngine.java:100)
	at org.eclipse.dltk.internal.core.Openable.codeSelect(Openable.java:624)
	at org.eclipse.dltk.internal.core.Openable.codeSelect(Openable.java:636)
	at org.eclipse.dltk.internal.core.AbstractSourceModule.codeSelect(AbstractSourceModule.java:86)
	at org.eclipse.dltk.internal.core.AbstractSourceModule.codeSelect(AbstractSourceModule.java:77)
	at org.eclipse.php.internal.ui.actions.OpenTypeHierarchyAction.getSelectionModelElement(OpenTypeHierarchyAction.java:205)
	at org.eclipse.php.internal.ui.actions.OpenTypeHierarchyAction.isEnabled(OpenTypeHierarchyAction.java:155)
	at org.eclipse.php.internal.ui.actions.OpenTypeHierarchyAction.access$0(OpenTypeHierarchyAction.java:149)
	at org.eclipse.php.internal.ui.actions.OpenTypeHierarchyAction$1.run(OpenTypeHierarchyAction.java:117)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)





Reproducible: Sometimes

Steps to Reproduce:
Add new line of code and quickly remove it before background thread finishes reading source model.
Comment 1 Natalia Bartol CLA 2012-01-25 07:46:29 EST
This may happen as a result of moving OpenTypeHierarchyAction to non UI job: bug 368947.
Comment 2 Natalia Bartol CLA 2012-01-25 07:56:57 EST
Created attachment 210046 [details]
IndexOutOfBoundsException caught in PHPSelectionEngine - patch

Better IndexOutOfBoundsException handling in PHPSelectionEngine. As we are aware that concurrent source model access is allowed (and synchronization would badly affect editor's performance) internalASTResolve() returns null in case of exception thrown. This allows
Comment 3 Roy Ganor CLA 2012-01-26 06:44:44 EST
thanks!
Comment 4 Kalin CLA 2012-07-06 10:24:05 EDT
No longer reproduced.
Closing...

Kalin Yanev
kalin.a@zend.com