roterdam / jchord

Automatically exported from code.google.com/p/jchord
3 stars 0 forks source link

Deadlock not found #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

I have some code (attached) that contains a deadlock, but jchord does not 
detect it.

My chord.properties file looks like the following:
chord.main.class=test.TwoThreadsThatDeadlock
chord.class.path=bin
chord.src.path=src

I ran jchord using the following command:
ant -Dchord.work.dir=/home/user/workspace/Deadlocks 
-Dchord.run.analyses=deadlock-java run

The chord_output/deadlocklist.xml in the Deadlocks folder contains no deadlock:
<deadlocklist>
</deadlocklist>

I'm using chord 2.0a on Linux with OpenJDK 64-Bit Server VM (build 16.0-b13, 
mixed mode)

Is there something I'm doing wrong?

Best regards,
  Silviu

Original issue reported on code.google.com by silviu.a...@gmail.com on 16 Aug 2010 at 4:13

Attachments:

GoogleCodeExporter commented 9 years ago
Hello,

google kept saying there was an error with posting the issue. Thus, I retried. 
So, until issue #39, it's all me. 

Sorry about that. 

Best regards,
  Silviu

Original comment by silviu.a...@gmail.com on 16 Aug 2010 at 4:19

GoogleCodeExporter commented 9 years ago
Hi, I deleted the issues after #29.  I'm not actively maintaining the release 
version you used; I tried the trunk and the deadlock checker works fine.  There 
is a problem with the way the test case is written, however.  The locks you use 
are string constants, which Chord does not model.  So you will need to create 
locks using, e.g., "new Object()".  See the modified file I've attached.

After that change, you may get lots of deadlock reports if you run the above 
command as is.  To prevent this, you need to set:

public final static String DEFAULT_SCOPE_EXCLUDES =
concat(mainClassPathPackages, ',', 
"sun.,com.sun.,com.ibm.,org.apache.harmony.");

in file main/src/java/chord/project/Config.java (currently, the scope only 
excludes mainClassPathPackages).

After that, you will get 4 deadlock reports instead of 1.  This is because of 
the context-insensitive points-to analysis that is used by default.

So you will need to set -Dchord.inst.ctxt.kind=co on the command line, that is:

ant -Dchord.work.dir=... -Dchord.run.analyses=deadlock-java 
-Dchord.inst.ctxt.kind=co run

and then you will get just 1 deadlock report.  Email me if you run into any 
other problems.

Original comment by mayur.naik on 17 Aug 2010 at 4:13

Attachments: