This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 45076 - NPE and concurrent accesses
Summary: NPE and concurrent accesses
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC Windows ME/2000
: P1 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-17 10:12 UTC by orichaud
Modified: 2004-08-13 12:11 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description orichaud 2004-06-17 10:12:34 UTC
Build number: 200405251800
MDR : Standalone  
Platform : Windows 2003
Java : JDK 1.4.2 (Sun)
My highly multithreaded application on top of a 
single repository suffers from random NPE thrown 
by MDR when 2 or more threads access the model to 
read data. 

Each thread starts its own transaction.

The first thread reading objects doesn't encouter 
any problem, but at some point, the following 
threads
tend to report random NPE when accessing both 
atttributes and references. MDR also fails to 
retrieve objects 
using their MOF ID and returns a null reference 
as for a non existing object. hence, an 
attribute, a reference or
a Classifier may not be found also it clearly 
exists. For example, when requesting an 
attribute's type, MDR
will sometimes returns null. Or, even, this 
attributes may not be found by MDR.

This doesn't happen when opening the MDR for 
update as my application holds in this case a 
Write lock.

I've managed to avoid those NPE by protecting MDR 
sections with a mutex which forces serialized 
accesses 
to MDR. And as I'm protecting each MDR call with 
a mutex, I'm having less and less NPE or null 
objects returned.

Here are some NPE (or DebugException) and 
stacktraces that are thrown without protecting 
MDR with a mutex :

Caused by: org.netbeans.mdr.util.DebugException
	at 
org.netbeans.mdr.storagemodel.StorableAssociation.
checkType(StorableAssociation.java:361)
	at 
org.netbeans.mdr.handlers.InstanceHandler._handleG
etR(InstanceHandler.java:110)
	at 
javax.jmi.model.AssociationEnd$Impl.getContainer
(Unknown Source)
	at 
org.netbeans.jmiimpl.mof.model.AssociationEndImpl.
otherEnd(AssociationEndImpl.java:35)
	at 
javax.jmi.model.AssociationEnd$Impl.otherEnd
(Unknown Source)
	at 
org.netbeans.jmiimpl.mof.model.ExposesImpl.getExpo
sedEnd(ExposesImpl.java:62)
	at 
javax.jmi.model.Exposes$Impl.getExposedEnd
(Unknown Source)
	at javax.jmi.model.Exposes$Impl._query
(Unknown Source)
	at 
org.netbeans.mdr.handlers.InstanceHandler._handleG
etR(InstanceHandler.java:106)
	at 
javax.jmi.model.Reference$Impl.getExposedEnd
(Unknown Source)

Caused by: java.lang.NullPointerException
	at 
org.netbeans.jmiimpl.mof.model.AssociationEndImpl.
otherEnd(AssociationEndImpl.java:35)
	at 
javax.jmi.model.AssociationEnd$Impl.otherEnd
(Unknown Source)
	at 
org.netbeans.jmiimpl.mof.model.ExposesImpl.getExpo
sedEnd(ExposesImpl.java:62)
	at 
javax.jmi.model.Exposes$Impl.getExposedEnd
(Unknown Source)
	at javax.jmi.model.Exposes$Impl._query
(Unknown Source)
	at 
org.netbeans.mdr.handlers.InstanceHandler._handleG
etR(InstanceHandler.java:106)
	at 
javax.jmi.model.Reference$Impl.getExposedEnd
(Unknown Source)
Comment 1 Martin Matula 2004-06-17 23:23:05 UTC
Should be fixed. Added missing implicit read transactions to query
operations implementation.