You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "Dawid Weiss (JIRA)" <ji...@apache.org> on 2013/05/21 22:45:20 UTC

[jira] [Commented] (MAHOUT-1225) OpenIntHashSet hangs on forever on the fourth add.

    [ https://issues.apache.org/jira/browse/MAHOUT-1225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13663384#comment-13663384 ] 

Dawid Weiss commented on MAHOUT-1225:
-------------------------------------

This is a legitimate bug in clear():
{code}
  public void clear() {
    Arrays.fill(this.state, 0, state.length - 1, FREE);
{code}

The "to" argument is wrong, it is an exclusive range so it should be state.length. Since the last element of the state array is not cleared it is subsequently filled entirely and indexOfKey hangs on the lookup loop (because all slots are "taken").

Simpler problem reproduction code:
{code}
 AbstractIntSet s = new OpenIntHashSet();
            s.clear();
            s.add(23);
            s.add(46);
            s.clear();
            s.add(70);
            s.add(93);
            s.contains(100);
{code}
                
> OpenIntHashSet hangs on forever on the fourth add.
> --------------------------------------------------
>
>                 Key: MAHOUT-1225
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-1225
>             Project: Mahout
>          Issue Type: Bug
>          Components: Math
>    Affects Versions: 0.7
>         Environment: Eclipse, linux Fedora 17, Java 1.7, Mahout Maths collections (Set) 0.7, hppc 0.4.3
>            Reporter: Sophie Sperner
>              Labels: hashset, java, mahout, test
>             Fix For: 0.7
>
>         Attachments: hppc-0.4.3.jar, mushroom.dat, test.java
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> The code I attached hangs on forever, Eclipse does not print me its stack trace because it does not terminate the program. So I decided to make a small test.java file that you can easily run.
> This code has the main function that simply runs getItemList() method which successfully executes getDataset() method (here please download mushroom.dat dataset and set the full path into filePath string variable) and the hangs on (the problem happens on a fourth columnValues.add() call). After the dataset was taken into X array, the code simply goes through X column by column and searches for different items in it.
> If you uncomment IntSet columnValues = new IntOpenHashSet(); and corresponding import headers then everything will work just fine (you will also need to include hppc jar file found here http://labs.carrotsearch.com/hppc.html or below in the attachment).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira