Another issue :)

View: New views
4 Messages — Rating Filter:   Alert me  

Another issue :)

by Paul Stadig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

So another issue that I ran into was that in some of the Clojure data structures it makes copies of arrays by using clone(). That seemed to cause a problem for TC, because I would unexpectedly get NPEs. The standard diagnoses for this issue didn't help. All of my classes were instrumented, etc., etc.

What eventually helped was to change the array.clone() to new Object[size]; System.arraycopy(...). Is this also a bug? Or was I doing something incorrectly?


Paul

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Another issue :)

by Alex Miller-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There's a pretty nasty bug related to clone() that is fixed in 3.0.  
Are you using 2.7.3 or 3.0-snapshot?  Got stack trace?


On Apr 2, 2009, at 3:43 PM, Paul Stadig wrote:

> So another issue that I ran into was that in some of the Clojure  
> data structures it makes copies of arrays by using clone(). That  
> seemed to cause a problem for TC, because I would unexpectedly get  
> NPEs. The standard diagnoses for this issue didn't help. All of my  
> classes were instrumented, etc., etc.
>
> What eventually helped was to change the array.clone() to new  
> Object[size]; System.arraycopy(...). Is this also a bug? Or was I  
> doing something incorrectly?
>
>
> Paul
> _______________________________________________
> tc-users mailing list
> tc-users@...
> http://lists.terracotta.org/mailman/listinfo/tc-users

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Another issue :)

by Paul Stadig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm using 2.7.3. I've already worked around the issue, and because of the way Clojure generates exceptions, it was a pretty deeply nested stack trace. When I get a chance I can back out my changes and try running against 3.0 and see if I'm still having an issue.


Paul

On Thu, Apr 2, 2009 at 4:53 PM, Alex Miller <amiller@...> wrote:
There's a pretty nasty bug related to clone() that is fixed in 3.0.
Are you using 2.7.3 or 3.0-snapshot?  Got stack trace?


On Apr 2, 2009, at 3:43 PM, Paul Stadig wrote:

> So another issue that I ran into was that in some of the Clojure
> data structures it makes copies of arrays by using clone(). That
> seemed to cause a problem for TC, because I would unexpectedly get
> NPEs. The standard diagnoses for this issue didn't help. All of my
> classes were instrumented, etc., etc.
>
> What eventually helped was to change the array.clone() to new
> Object[size]; System.arraycopy(...). Is this also a bug? Or was I
> doing something incorrectly?
>
>
> Paul
> _______________________________________________
> tc-users mailing list
> tc-users@...
> http://lists.terracotta.org/mailman/listinfo/tc-users

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Another issue :)

by teck-terracotta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Actually looks like there is indeed a bug with clone() on clustered array
instances. We do special instrumentation for calls that are compile time
bound to Object.clone(), but it looks like calls on array types do not
follow that pattern. I'll add another bug, thanks Paul. The change to
new+arraycopy should be safe.

On a related note, we recently wrote a benchmark that showed that
new+arraycopy is a touch faster than clone(). At least for byte[] on a 1.6
VM.

> -----Original Message-----
> From: tc-users-bounces@... [mailto:tc-users-
> bounces@...] On Behalf Of Alex Miller
> Sent: Thursday, April 02, 2009 1:54 PM
> To: tc-users@...
> Subject: Re: [tc-users] Another issue :)
>
> There's a pretty nasty bug related to clone() that is fixed in 3.0.
> Are you using 2.7.3 or 3.0-snapshot?  Got stack trace?
>
>
> On Apr 2, 2009, at 3:43 PM, Paul Stadig wrote:
>
> > So another issue that I ran into was that in some of the Clojure
> > data structures it makes copies of arrays by using clone(). That
> > seemed to cause a problem for TC, because I would unexpectedly get
> > NPEs. The standard diagnoses for this issue didn't help. All of my
> > classes were instrumented, etc., etc.
> >
> > What eventually helped was to change the array.clone() to new
> > Object[size]; System.arraycopy(...). Is this also a bug? Or was I
> > doing something incorrectly?
> >
> >
> > Paul
> > _______________________________________________
> > tc-users mailing list
> > tc-users@...
> > http://lists.terracotta.org/mailman/listinfo/tc-users
>
> _______________________________________________
> tc-users mailing list
> tc-users@...
> http://lists.terracotta.org/mailman/listinfo/tc-users
_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users