JDK methods won't rollback

62 views
Skip to first unread message

José Pereira

unread,
Oct 12, 2013, 6:57:28 PM10/12/13
to deuce-stm-...@googlegroups.com
Hi all,

methods to jdk classes don't rollback in case of an abort (ex: adding a value to an Arraylist, after abort the value remains there).
I instrumented the rt.jar (java -cp deuceAgent-1.3.0.jar -Dorg.deuce.exclude='' org.deuce.transform.asm.Agent rt.jar rt_instrumented.jar), Instrumented my jar (java -jar deuceAgent-1.3.0.jar Main.jar Mainout.jar) and finally ran java -Xbootclasspath/p:rt_instrumented.jar:deuceAgent-1.3.0.jar -jar Mainout.jar.

The program is very simple:

public class Main implements Runnable {

public    ArrayList<String> mapa;

    public Main() {
        mapa = new ArrayList<String>();
    }
      public void run () {
        addvalue();
      }

    @Atomic(retries=1)
    public void addvalue() {
        mapa.add("aaa");
throw new TransactionException("Key not found");


    }

    public static void main(String[] args) {
        Main m = new Main();
            Thread thread = new Thread(m);
            thread.start();
            try{
                Thread.sleep(3 * 1000);
            }catch(Exception e){}       
        System.out.println(m.mapa.size() );
    }
}

Size prints 1.

What am i missing here, any help?

Thx in advance.

Guy Korland

unread,
Oct 14, 2013, 9:23:06 PM10/14/13
to deuce-stm-developers

Can you open the instrumented rt. jar and check that it was instrumented?

--
You received this message because you are subscribed to the Google Groups "Deuce-STM developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deuce-stm-develo...@googlegroups.com.
To post to this group, send email to deuce-stm-...@googlegroups.com.
Visit this group at http://groups.google.com/group/deuce-stm-developers.
For more options, visit https://groups.google.com/groups/opt_out.

José Pereira

unread,
Oct 15, 2013, 12:18:07 AM10/15/13
to deuce-stm-...@googlegroups.com
Hello,

First of all thanks for your response. I'm not completely sure they are correctly instrumented since i'm not reading their bytecode, but since the instrumented jar (rt_instrumented.jar) has every class in the non instrumented (rt.jar) plus almost every class of every package has a corresponding <class name>DeuceFieldsHolder.class (example:ArrayList$1DeuceFieldsHolder.class) i'm assuming the rt.jar is being well instrumented (not to mention the difference of total size between the two jars, the instrumented one is 2mb smaller) .

To be more explicit with the commands and with what i'm doing, this is the exact sequence of commands i run, having only Main.java and a copy of rt.jar in . directory:


java -cp deuceAgent-1.3.0.jar -Dorg.deuce.exclude='' org.deuce.transform.asm.Agent rt.jar rt_instrumented.jar
Oct 15, 2013 4:52:16 AM org.deuce.transform.asm.Agent transformJar
INFO: Start tranlating source:rt.jar target:rt_instrumented.jar
Oct 15, 2013 4:52:29 AM org.deuce.transform.asm.Agent transformJar
INFO: Closing source:rt.jar target:rt_instrumented.jar
javac -cp "deuceAgent-1.3.0.jar"  Main.java
jar cvf Main.jar Main.class
added manifest
adding: Main.class(in = 1241) (out= 747)(deflated 39%)

----at this point i manually change the manifest to add Main-Class property-------

java -jar deuceAgent-1.3.0.jar Main.jar Mainout.jar
Oct 15, 2013 4:54:58 AM org.deuce.transform.asm.Agent transformJar
INFO: Start tranlating source:Main.jar target:Mainout.jar
Oct 15, 2013 4:54:58 AM org.deuce.transform.asm.Agent transformJar
INFO: Closing source:Main.jar target:Mainout.jar

java -Xbootclasspath/p:rt_instrumented.jar:deuceAgent-1.3.0.jar -jar Mainout.jar
Exception in thread "Thread-0" org.deuce.transaction.TransactionException: Failed to commit the transaction in the defined retries.
1

 Thanks in advance.
To unsubscribe from this group and stop receiving emails from it, send an email to deuce-stm-developers+unsub...@googlegroups.com.

Guy Korland

unread,
Oct 15, 2013, 1:54:55 AM10/15/13
to deuce-stm-developers

Just to be on the safe side the rt offline instrumentation is missing ".

To unsubscribe from this group and stop receiving emails from it, send an email to deuce-stm-develo...@googlegroups.com.

José Pereira

unread,
Oct 15, 2013, 10:04:15 AM10/15/13
to deuce-stm-...@googlegroups.com
Yeah my fault for not making that clear, but i'm using ' and not ", therefore it's '   ' in the command -Dorg.deuce.exclude=''. So it's all fine there i guess, any other idea why the instrumented jar isn't working?
To unsubscribe from this group and stop receiving emails from it, send an email to deuce-stm-developers+unsubscrib...@googlegroups.com.

To post to this group, send email to deuce-stm-...@googlegroups.com.
Visit this group at http://groups.google.com/group/deuce-stm-developers.
For more options, visit https://groups.google.com/groups/opt_out.

Fernando Miguel Carvalho

unread,
Oct 15, 2013, 11:12:38 AM10/15/13
to deuce-stm-...@googlegroups.com
When you instrument your application---Main.jar---you should also include the -Dorg.deuce.exclude='', otherwise it will consider the non-transactional version of the ArrayList.

José Pereira

unread,
Oct 15, 2013, 9:53:38 PM10/15/13
to deuce-stm-...@googlegroups.com
Yep, that solved my problem, thank you very much!!
Reply all
Reply to author
Forward
0 new messages