Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 266124

Summary: NPE during handleInvalidation in CDOViewImpl
Product: [Modeling] EMF Reporter: Anders Forsell <aforsell1971>
Component: cdo.coreAssignee: Simon Mc Duff <smcduff>
Status: CLOSED WORKSFORME QA Contact:
Severity: major    
Priority: P3 CC: smcduff, stepper
Version: 2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Anders Forsell CLA 2009-02-25 08:39:38 EST
I have turned on change policy "CDOAdapterPolicy.ALL" for my transaction. I do get the expected EMF notifications on the client, but I am also getting a NullPointerException in "handleInvalidation", CDOViewImpl line 1083, "synchronized (objects)", where objects is null (stack trace is below).
Also, the NPE was seen in "reload()" line 1340, "synchronized (object)".

I am using CDO 2.0 (M5).

Could it be a race condition where the "doDeactivate()" sets "objects" to null, and then other threads are accessing the "handleInvalidation" or "reload" methods?

The following state of the CDOTransaction was copied from the debugger, when it was stopped in "handleInvalidation":

adapterPolicyManager	CDOViewImpl$AdapterManager  (id=194)	
changeSubscriptionManager	null	
conflict	0	
dirty	false	
featureAnalyzer	null	
firstSavepoint	null	
handlers	ArrayList<E>  (id=202)	
lastCommitTime	0	
lastLookupID	null	
lastLookupObject	null	
lastSavepoint	null	
lastTemporaryID	0	
lifecycleSemaphore	Semaphore  (id=207)	
lifecycleState	ILifecycleState  (id=209)	
listeners	ArrayList<E>  (id=211)	
lock	ReentrantLock  (id=213)	
objects	null	
options	null	
rootResource	null	
session	null	
store	null	
transactionStrategy	null	
uriHandler	CDOURIHandler  (id=221)	
viewID	9	
viewSet	null	

This is the stack trace:

!ENTRY org.eclipse.emf.cdo 4 0 2009-02-25 14:29:36.913
!MESSAGE NullPointerException
!STACK 0
java.lang.NullPointerException
	at org.eclipse.emf.internal.cdo.view.CDOViewImpl.handleInvalidation(CDOViewImpl.java:1086)
	at org.eclipse.emf.internal.cdo.session.CDOSessionImpl$1.run(CDOSessionImpl.java:570)
	at org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:26)
	at org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:1)
	at org.eclipse.net4j.util.concurrent.QueueWorker.work(QueueWorker.java:64)
	at org.eclipse.net4j.util.concurrent.Worker$WorkerThread.run(Worker.java:154)
Comment 1 Simon Mc Duff CLA 2009-02-25 09:10:05 EST
*** Bug 266125 has been marked as a duplicate of this bug. ***
Comment 2 Simon Mc Duff CLA 2009-02-25 10:02:13 EST
Hi Anders!
Thank you for your analysis.
It is failing since the CDOViewImpl seems to be inactive!
Is it true that your view is inactive ?
I will say for reload it will throw an exception. (if you can provide the stack trace for reload.. would be good).

In the case of handleINvalidation... it will only check without throwing exception.. since the view is invalid.

Does it make sense ?


(In reply to comment #0)
> I have turned on change policy "CDOAdapterPolicy.ALL" for my transaction. I do
> get the expected EMF notifications on the client, but I am also getting a
> NullPointerException in "handleInvalidation", CDOViewImpl line 1083,
> "synchronized (objects)", where objects is null (stack trace is below).
> Also, the NPE was seen in "reload()" line 1340, "synchronized (object)".
> I am using CDO 2.0 (M5).
> Could it be a race condition where the "doDeactivate()" sets "objects" to null,
> and then other threads are accessing the "handleInvalidation" or "reload"
> methods?
> The following state of the CDOTransaction was copied from the debugger, when it
> was stopped in "handleInvalidation":
> adapterPolicyManager    CDOViewImpl$AdapterManager  (id=194)    
> changeSubscriptionManager       null    
> conflict        0       
> dirty   false   
> featureAnalyzer null    
> firstSavepoint  null    
> handlers        ArrayList<E>  (id=202)  
> lastCommitTime  0       
> lastLookupID    null    
> lastLookupObject        null    
> lastSavepoint   null    
> lastTemporaryID 0       
> lifecycleSemaphore      Semaphore  (id=207)     
> lifecycleState  ILifecycleState  (id=209)       
> listeners       ArrayList<E>  (id=211)  
> lock    ReentrantLock  (id=213) 
> objects null    
> options null    
> rootResource    null    
> session null    
> store   null    
> transactionStrategy     null    
> uriHandler      CDOURIHandler  (id=221) 
> viewID  9       
> viewSet null    
> This is the stack trace:
> !ENTRY org.eclipse.emf.cdo 4 0 2009-02-25 14:29:36.913
> !MESSAGE NullPointerException
> !STACK 0
> java.lang.NullPointerException
>         at
> org.eclipse.emf.internal.cdo.view.CDOViewImpl.handleInvalidation(CDOViewImpl.java:1086)
>         at
> org.eclipse.emf.internal.cdo.session.CDOSessionImpl$1.run(CDOSessionImpl.java:570)
>         at
> org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:26)
>         at
> org.eclipse.net4j.util.concurrent.QueueRunner.work(QueueRunner.java:1)
>         at
> org.eclipse.net4j.util.concurrent.QueueWorker.work(QueueWorker.java:64)
>         at
> org.eclipse.net4j.util.concurrent.Worker$WorkerThread.run(Worker.java:154)

Comment 3 Eike Stepper CLA 2009-04-04 03:32:49 EDT
Anders, can we go on with this?
Comment 4 Anders Forsell CLA 2009-04-05 01:08:32 EDT
yes, sorry i did not notice this... I am on vacation for a week and will update as soon as i am back. 
Comment 5 Eike Stepper CLA 2009-04-05 04:37:06 EDT
No hurry! I'm just doing some bugzilla cleansing :P
Comment 6 Anders Forsell CLA 2009-04-28 04:13:06 EDT
I have refactored my code a bit since experiencing this problem, and now I cannot see it anymore.
Simon might be right that the view was not active.
You can close this bug.
Comment 7 Eike Stepper CLA 2009-05-25 05:23:21 EDT
Please re-open if you encounter this problem again.
Comment 8 Eike Stepper CLA 2010-06-29 04:43:14 EDT
Closing