Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Exception occured in OCL.dispose()
Exception occured in OCL.dispose() [message #69714] Tue, 07 April 2009 02:35 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

--=-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.&nbsp; That should be a good starting clue.<BR>
<BR>
Usually, unloading resources is a fairly simple procedure.&nbsp; Are you attempting to concurrently dispose your OCL instance from two or more threads?&nbsp; 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&lt;-----
</BODY>
</HTML>

--=-0NWJw5W+YRFz1QlhAez7--
Re: Exception occured in OCL.dispose() [message #69755 is a reply to message #69737] Thu, 09 April 2009 02:27 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

--=-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.&nbsp; The only operation on this line that could throw an NPE is the array-index operator &quot;[]&quot;.&nbsp; It is the &quot;data&quot; variable that is null.<BR>
<BR>
This definitely looks, then, like a concurrency problem.&nbsp; Some other thread has already unloaded the contents and cleared the list, which causes &quot;data&quot; to revert to null.<BR>
<BR>
At least, this is the only guess that I have to offer.&nbsp; At any rate, it isn't an OCL-specific problem.&nbsp; 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 &quot;data[index]&quot; was null:

public E get(int index)
{
if (index &gt;= 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:
&gt; Hi, Hao,
&gt;
&gt; I don't have the EMF source handy, so I don't know which pointer is null
&gt; at line 537 of BasicEList.java. That should be a good starting clue.
&gt;
&gt; Usually, unloading resources is a fairly simple procedure. Are you
&gt; attempting to concurrently dispose your OCL instance from two or more
&gt; threads? Did you somehow manage to store a null pointer in the resource
&gt; contents (which should not allow nulls)?
&gt;
&gt; I'm afraid you'll just have to debug this one.
&gt;
&gt; Cheers,
&gt;
&gt; Christian
&gt;
&gt;
&gt; On Tue, 2009-04-07 at 10:35 +0800, Hao Zhang wrote:
&gt;&gt; Hi,
&gt;&gt; In a project we've been using eclipse OCL (build v1.2.0v200712152058) to evaluate ocl expressions. Recently we got
&gt;&gt; following exception and we couldn't tell the reason, could you imagine how it would occur? I know it is hard but we
&gt;&gt; really need some clue, thanks in advance.
&gt; -----8&lt;-----
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-a892w7nXAydydo0DtLoT--
Previous Topic:Include OCL restrictions in the EMF MetaModel
Next Topic:EPL and OCL
Goto Forum:
  


Current Time: Thu Mar 28 19:55:19 GMT 2024

Powered by FUDForum. Page generated in 0.05435 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top