| Summary: | File not found exception using content assist on JSP page | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] WTP Source Editing | Reporter: | Chris Stodden <chris.stodden> | ||||||||
| Component: | jst.jsp | Assignee: | Nick Sandonato <nsand.dev> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | Nick Sandonato <nsand.dev> | ||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | carlin.rogers, rakes123, thatnitind | ||||||||
| Version: | 3.2.2 | Flags: | thatnitind:
review+
|
||||||||
| Target Milestone: | 3.2.3 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows XP | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Chris Stodden
I was able to reproduce it , but very few times.And it can occur randomly while editing. One possible reason for above error is possibility of creation of two threads, with two JspTranslators , one is removing buffer(from org.eclipse.jdt.internal.core.BufferManager)and another adding it.This exception occurs if thread A creates a buffer adds it to BuffersManager later try to retrieve it, but fails since it has already been deleted by Thread B. If we look at JSPTranslationAdapter.getJSPTranslation()(Lets say in Thread A from explanation above) , it is releasing jspTranslation and creating it at the very next line . In JspTranslation().release() it take a lock and creates a separate Job for releasing buffer(Lets call it Thread B). As soon as we return from this function , a new translator is created at next line in JSPTranslationAdapter. Now we have two jspTranslators in two threads , using separate locks for synchronization. I have used class lock for locking.Let me know if my analysis is correct. Created attachment 181492 [details]
patch
Rakesh, wouldn't locking on JSPTranslation.this cause you to still lock on each instance of the enclosing JSPTranslation instance, causing two different locks still? (In reply to comment #1) > I was able to reproduce it , but very few times.And it can occur randomly while > editing. > > One possible reason for above error is possibility of creation of two threads, > with two JspTranslators , one is removing buffer(from > org.eclipse.jdt.internal.core.BufferManager)and another adding it.This > exception occurs if thread A creates a buffer adds it to BuffersManager later > try to retrieve it, but fails since it has already been deleted by Thread B. > > If we look at JSPTranslationAdapter.getJSPTranslation()(Lets say in Thread A > from explanation above) , it is releasing jspTranslation and creating it at the > very next line . > In JspTranslation().release() it take a lock and creates a separate Job for > releasing buffer(Lets call it Thread B). > As soon as we return from this function , a new translator is created at next > line in JSPTranslationAdapter. > > Now we have two jspTranslators in two threads , using separate locks for > synchronization. > > I have used class lock for locking.Let me know if my analysis is correct. Created attachment 181573 [details]
patch
Sorry!!! it was meant to be JSPTranslation.class
Yes, I've also ran into this issue while editing a page. Created attachment 184663 [details] patch Hi, Rakesh. Your analysis is right; it looks like this came about when the WorkspaceJob was added for Bug 243547. While I think your patch is straightforward and would likely work, it may also not provide the best throughput as all translations would block on this, not just ones related to the particular compilation unit. My reaction was "why are we discarding it, only to create a new translation?" This patch reuses translations when they're dirty, and resets the compilation unit's contents. Code checked in. Thanks for the review, Nitin. |