strange performance heisenbug

13 views
Skip to first unread message

Vijay Varanasi

unread,
Jul 22, 2009, 12:28:35 AM7/22/09
to Deuce-STM
Hi Guy,

Deuce is indeed simple to use, and I wish you all the best with your
Ph.D!

A couple of points:
1. I wrote a simple test program (see below) and noticed that multiple
runs of it are not consistent w.r.t performance: some of the runs
finish soon, while others take a long time. In fact, it looks like
some of the runs are stuck forever, and I have to kill them.

2. But here's the fun fact : you can make it run faster by connecting
to it in debug mode! I do not know why (did not dig up in the source),
but here's how to reproduce the issue. Run the code using -Xdebug.
(Assuming you hit the performance problem mentioned in point 1
above,) you will notice that it prints out "Changing from 0 to 1" (or
a few more stpes) and gets stuck, taking up ~ 80% CPU. Now if you run
jdb to connect to the process, voila!, it's done in 1 second, and jdb
fails to connect

java -Xdebug -
Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5555 -
javaagent:c:/Temp/install/deuce_java_stm/deuceAgent-1.0.0.jar
HelloWorld

sun.misc.Launcher$AppClassLoader@92e78c interface
org.deuce.objectweb.asm.ClassVisitor
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transaction.global.ClassTransformer
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transform.asm.ByteCodeVisitor
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transform.asm.Agent
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.objectweb.asm.ClassAdapter
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transform.asm.ClassTransformer
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transform.util.IgnoreTree
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transform.asm.FramesCodeVisitor$VersionException
sun.misc.Launcher$AppClassLoader@92e78c class
org.deuce.transform.util.IgnoreTree$TreeNode
Changed from 0 to 1
Changed from 1 to 2
Changed from 2 to 3
<stuck>

jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=5555
Set uncaught java.lang.Throwable

================ simple test =================
package deucetest;

import java.util.ArrayList;
import java.util.List;

import org.deuce.Atomic;

/**
* {@link #incrementX()} is made atomic using org.deuce.Atomic, which
effectively
* serializes the incrementing in order from 0 to 100.
*
* @author varanav
*
*/
public class HelloWorld {


static Integer x = new Integer(0);

/**
* @param args
*/
public static void main(String[] args) {
List<Thread> l = new ArrayList<Thread>();
for (int i = 0; i < 100; i++) {
Thread t = new Thread() {
public void run() {
incrementX();
}
};
t.start();
l.add(t);
}

try {
for (Thread t: l) t.join();
} catch (InterruptedException e) {
System.err.println("thread interrupted during join()");
}

System.out.println(x);
} // main

@Atomic
public static void incrementX() {
int xInt = x.intValue();
// try { Thread.sleep( Math.abs((new Random()).nextInt() %
5)); } catch (InterruptedException e) {}
x = Integer.valueOf(xInt + 1);
System.out.println("Changed from " + xInt + " to " + x.intValue
());
}
}

Guy Korland

unread,
Jul 22, 2009, 12:46:09 AM7/22/09
to deuc...@googlegroups.com
Thanks, 
I'll check it and get back to you.

Guy
--
Guy Korland

Guy Korland

unread,
Aug 1, 2009, 12:05:47 PM8/1/09
to deuc...@googlegroups.com
Hi,

I ran your test on a dual core machine and it ran without any issues.
Can you please add more details?
1. Which machine are you using?
2. When the test stuck is the JVM still taking a lot of CPU?
3. Do you see the same transaction again and again?
4. can you try with the global lock reference? -Dorg.deuce.transaction.global=true

Thanks,
Guy

On Wed, Jul 22, 2009 at 7:28 AM, Vijay Varanasi <vij...@gmail.com> wrote:



--
Guy Korland

Guy Korland

unread,
Aug 1, 2009, 12:11:03 PM8/1/09
to deuc...@googlegroups.com
--
Guy Korland
Reply all
Reply to author
Forward
Message has been deleted
0 new messages