Home » Modeling » OCL » Exception occured in OCL.dispose()
Exception occured in OCL.dispose() [message #69714] |
Tue, 07 April 2009 02:35 |
Eclipse User |
|
|
|
Originally posted by: zzhangh.cn.ibm.com
Hi,
In a project we've been using eclipse OCL (build v1.2.0v200712152058) to evaluate ocl expressions. Recently we got
following exception and we couldn't tell the reason, could you imagine how it would occur? I know it is hard but we
really need some clue, thanks in advance.
Caused by:
java.lang.NullPointerException
at org.eclipse.emf.common.util.BasicEList.get(BasicEList.java:5 37)
at org.eclipse.emf.common.util.BasicEList$EIterator.doNext(Basi cEList.java:1325)
at org.eclipse.emf.common.util.BasicEList$EIterator.next(BasicE List.java:1312)
at org.eclipse.emf.common.util.BasicEList.addAllUnique(BasicELi st.java:739)
at org.eclipse.emf.common.util.BasicEList.addAll(BasicEList.jav a:716)
at org.eclipse.emf.common.util.BasicEList$FastCompare.<init>(BasicEList.java:1981)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.unload(Reso urceImpl.java:1550)
at org.eclipse.ocl.AbstractTypeResolver.dispose(AbstractTypeRes olver.java:937)
at org.eclipse.ocl.AbstractEnvironment.dispose(AbstractEnvironm ent.java:1129)
at org.eclipse.ocl.OCL.dispose(OCL.java:653)
Regards,
Hao
|
|
|
Re: Exception occured in OCL.dispose() [message #69737 is a reply to message #69714] |
Wed, 08 April 2009 12:36 |
|
--=-0NWJw5W+YRFz1QlhAez7
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi, Hao,
I don't have the EMF source handy, so I don't know which pointer is null
at line 537 of BasicEList.java. That should be a good starting clue.
Usually, unloading resources is a fairly simple procedure. Are you
attempting to concurrently dispose your OCL instance from two or more
threads? Did you somehow manage to store a null pointer in the resource
contents (which should not allow nulls)?
I'm afraid you'll just have to debug this one.
Cheers,
Christian
On Tue, 2009-04-07 at 10:35 +0800, Hao Zhang wrote:
> Hi,
> In a project we've been using eclipse OCL (build v1.2.0v200712152058) to evaluate ocl expressions. Recently we got
> following exception and we couldn't tell the reason, could you imagine how it would occur? I know it is hard but we
> really need some clue, thanks in advance.
-----8<-----
--=-0NWJw5W+YRFz1QlhAez7
Content-Type: text/html; charset="utf-8"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.24.1.1">
</HEAD>
<BODY>
Hi, Hao,<BR>
<BR>
I don't have the EMF source handy, so I don't know which pointer is null at line 537 of BasicEList.java. That should be a good starting clue.<BR>
<BR>
Usually, unloading resources is a fairly simple procedure. Are you attempting to concurrently dispose your OCL instance from two or more threads? Did you somehow manage to store a null pointer in the resource contents (which should not allow nulls)?<BR>
<BR>
I'm afraid you'll just have to debug this one.<BR>
<BR>
Cheers,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Tue, 2009-04-07 at 10:35 +0800, Hao Zhang wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hi,
In a project we've been using eclipse OCL (build v1.2.0v200712152058) to evaluate ocl expressions. Recently we got
following exception and we couldn't tell the reason, could you imagine how it would occur? I know it is hard but we
really need some clue, thanks in advance.
</PRE>
</BLOCKQUOTE>
-----8<-----
</BODY>
</HTML>
--=-0NWJw5W+YRFz1QlhAez7--
|
|
|
Re: Exception occured in OCL.dispose() [message #69755 is a reply to message #69737] |
Thu, 09 April 2009 02:27 |
Eclipse User |
|
|
|
Originally posted by: zzhangh.cn.ibm.com
Christian,
The exception happened seldomly, I'm not able to re-produce and debug it easily. Below is related codes in BasicEList,
which shows that "data[index]" was null:
public E get(int index)
{
if (index >= size)
throw new BasicIndexOutOfBoundsException(index, size);
return resolve(index, (E)data[index]);//Line 537
}
Yes, in the project the OCL instance may be disposed from more threads (in a J2EE environment). However, I've made some
tests to concurrently create/dispose OCL instances (more than 100 threads) and I never got any exception, so I'm in
doubt whether it is due to multi-thread environment.
I'll appreciate if it brings you more thoughts, thanks!
Regards,
Hao
Christian W. Damus wrote:
> Hi, Hao,
>
> I don't have the EMF source handy, so I don't know which pointer is null
> at line 537 of BasicEList.java. That should be a good starting clue.
>
> Usually, unloading resources is a fairly simple procedure. Are you
> attempting to concurrently dispose your OCL instance from two or more
> threads? Did you somehow manage to store a null pointer in the resource
> contents (which should not allow nulls)?
>
> I'm afraid you'll just have to debug this one.
>
> Cheers,
>
> Christian
>
>
> On Tue, 2009-04-07 at 10:35 +0800, Hao Zhang wrote:
>> Hi,
>> In a project we've been using eclipse OCL (build v1.2.0v200712152058) to evaluate ocl expressions. Recently we got
>> following exception and we couldn't tell the reason, could you imagine how it would occur? I know it is hard but we
>> really need some clue, thanks in advance.
> -----8<-----
|
|
|
Re: Exception occured in OCL.dispose() [message #69774 is a reply to message #69755] |
Thu, 09 April 2009 12:39 |
|
--=-a892w7nXAydydo0DtLoT
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi, Hao,
The problem isn't that data[index] was null. The only operation on this
line that could throw an NPE is the array-index operator "[]". It is
the "data" variable that is null.
This definitely looks, then, like a concurrency problem. Some other
thread has already unloaded the contents and cleared the list, which
causes "data" to revert to null.
At least, this is the only guess that I have to offer. At any rate, it
isn't an OCL-specific problem. You will always need to externally
synchronize EMF operations on resources shared by multiple threads,
especially loading and unloading.
Cheers,
Christian
On Thu, 2009-04-09 at 10:27 +0800, Hao Zhang wrote:
> Christian,
> The exception happened seldomly, I'm not able to re-produce and debug it easily. Below is related codes in BasicEList,
> which shows that "data[index]" was null:
>
> public E get(int index)
> {
> if (index >= size)
> throw new BasicIndexOutOfBoundsException(index, size);
>
> return resolve(index, (E)data[index]);//Line 537
> }
>
> Yes, in the project the OCL instance may be disposed from more threads (in a J2EE environment). However, I've made some
> tests to concurrently create/dispose OCL instances (more than 100 threads) and I never got any exception, so I'm in
> doubt whether it is due to multi-thread environment.
>
> I'll appreciate if it brings you more thoughts, thanks!
>
> Regards,
> Hao
>
> Christian W. Damus wrote:
> > Hi, Hao,
> >
> > I don't have the EMF source handy, so I don't know which pointer is null
> > at line 537 of BasicEList.java. That should be a good starting clue.
> >
> > Usually, unloading resources is a fairly simple procedure. Are you
> > attempting to concurrently dispose your OCL instance from two or more
> > threads? Did you somehow manage to store a null pointer in the resource
> > contents (which should not allow nulls)?
> >
> > I'm afraid you'll just have to debug this one.
> >
> > Cheers,
> >
> > Christian
> >
> >
> > On Tue, 2009-04-07 at 10:35 +0800, Hao Zhang wrote:
> >> Hi,
> >> In a project we've been using eclipse OCL (build v1.2.0v200712152058) to evaluate ocl expressions. Recently we got
> >> following exception and we couldn't tell the reason, could you imagine how it would occur? I know it is hard but we
> >> really need some clue, thanks in advance.
> > -----8<-----
--=-a892w7nXAydydo0DtLoT
Content-Type: text/html; charset="utf-8"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.24.1.1">
</HEAD>
<BODY>
Hi, Hao,<BR>
<BR>
The problem isn't that data[index] was null. The only operation on this line that could throw an NPE is the array-index operator "[]". It is the "data" variable that is null.<BR>
<BR>
This definitely looks, then, like a concurrency problem. Some other thread has already unloaded the contents and cleared the list, which causes "data" to revert to null.<BR>
<BR>
At least, this is the only guess that I have to offer. At any rate, it isn't an OCL-specific problem. You will always need to externally synchronize EMF operations on resources shared by multiple threads, especially loading and unloading.<BR>
<BR>
Cheers,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Thu, 2009-04-09 at 10:27 +0800, Hao Zhang wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Christian,
The exception happened seldomly, I'm not able to re-produce and debug it easily. Below is related codes in BasicEList,
which shows that "data[index]" was null:
public E get(int index)
{
if (index >= size)
throw new BasicIndexOutOfBoundsException(index, size);
return resolve(index, (E)data[index]);//Line 537
}
Yes, in the project the OCL instance may be disposed from more threads (in a J2EE environment). However, I've made some
tests to concurrently create/dispose OCL instances (more than 100 threads) and I never got any exception, so I'm in
doubt whether it is due to multi-thread environment.
I'll appreciate if it brings you more thoughts, thanks!
Regards,
Hao
Christian W. Damus wrote:
> Hi, Hao,
>
> I don't have the EMF source handy, so I don't know which pointer is null
> at line 537 of BasicEList.java. That should be a good starting clue.
>
> Usually, unloading resources is a fairly simple procedure. Are you
> attempting to concurrently dispose your OCL instance from two or more
> threads? Did you somehow manage to store a null pointer in the resource
> contents (which should not allow nulls)?
>
> I'm afraid you'll just have to debug this one.
>
> Cheers,
>
> Christian
>
>
> On Tue, 2009-04-07 at 10:35 +0800, Hao Zhang wrote:
>> Hi,
>> In a project we've been using eclipse OCL (build v1.2.0v200712152058) to evaluate ocl expressions. Recently we got
>> following exception and we couldn't tell the reason, could you imagine how it would occur? I know it is hard but we
>> really need some clue, thanks in advance.
> -----8<-----
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>
--=-a892w7nXAydydo0DtLoT--
|
|
|
Goto Forum:
Current Time: Thu Mar 28 19:55:19 GMT 2024
Powered by FUDForum. Page generated in 0.05435 seconds
|