You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hama.apache.org by "Filipe Manana (JIRA)" <ji...@apache.org> on 2010/10/14 02:21:32 UTC

[jira] Created: (HAMA-307) BSPMaster - job ID counter is not read and updated atomically

BSPMaster - job ID counter is not read and updated atomically
-------------------------------------------------------------

                 Key: HAMA-307
                 URL: https://issues.apache.org/jira/browse/HAMA-307
             Project: Hama
          Issue Type: Bug
            Reporter: Filipe Manana
         Attachments: hama-307.patch

The nextJobId (int attribute) in BSPMaster is not read and updated atomically, therefore it's possible that concurrent requests get the same job ID and/or cause the job ID to not get incremented by the proper quantity.

The following simple patch fixes it.

Notice:

I changed the type from int to Integer.
This is to avoid doing the following in getNewJobId():

int id;
synchronized (this) {
  id = nextJobId++;
}

the instance (referenced by this) is synchronized in many places in BSPMaster, so by making nextJobId an Integer (object), we can synchronize on it, reducing contention times:

private Integer nextJobId = Integer.valueOf(1);

public BSPJobID getNewJobId() throws IOException {
    int id;
    synchronized (nextJobId) {
      id = nextJobId;
      nextJobId = Integer.valueOf(id + 1);
    }
    return new BSPJobID(this.masterIdentifier, id);
  }

cheers

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HAMA-307) BSPMaster - job ID counter is not read and updated atomically

Posted by "Edward J. Yoon (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HAMA-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920842#action_12920842 ] 

Edward J. Yoon commented on HAMA-307:
-------------------------------------

Nice patch! +1

P.S. Please fill out below information :) Current TRUNK is for 0.2.0 version

{code}
Component/s:  	 None
Affects Version/s: 	None
Fix Version/s: 	None 
{code}

> BSPMaster - job ID counter is not read and updated atomically
> -------------------------------------------------------------
>
>                 Key: HAMA-307
>                 URL: https://issues.apache.org/jira/browse/HAMA-307
>             Project: Hama
>          Issue Type: Bug
>            Reporter: Filipe Manana
>         Attachments: hama-307.patch
>
>
> The nextJobId (int attribute) in BSPMaster is not read and updated atomically, therefore it's possible that concurrent requests get the same job ID and/or cause the job ID to not get incremented by the proper quantity.
> The following simple patch fixes it.
> Notice:
> I changed the type from int to Integer.
> This is to avoid doing the following in getNewJobId():
> int id;
> synchronized (this) {
>   id = nextJobId++;
> }
> the instance (referenced by this) is synchronized in many places in BSPMaster, so by making nextJobId an Integer (object), we can synchronize on it, reducing contention times:
> private Integer nextJobId = Integer.valueOf(1);
> public BSPJobID getNewJobId() throws IOException {
>     int id;
>     synchronized (nextJobId) {
>       id = nextJobId;
>       nextJobId = Integer.valueOf(id + 1);
>     }
>     return new BSPJobID(this.masterIdentifier, id);
>   }
> cheers

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HAMA-307) BSPMaster - job ID counter is not read and updated atomically

Posted by "Edward J. Yoon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HAMA-307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edward J. Yoon resolved HAMA-307.
---------------------------------

    Resolution: Fixed
      Assignee: Edward J. Yoon

Thanks Filipe!

I've just committed this.

> BSPMaster - job ID counter is not read and updated atomically
> -------------------------------------------------------------
>
>                 Key: HAMA-307
>                 URL: https://issues.apache.org/jira/browse/HAMA-307
>             Project: Hama
>          Issue Type: Bug
>          Components: bsp
>    Affects Versions: 0.2.0
>            Reporter: Filipe Manana
>            Assignee: Edward J. Yoon
>             Fix For: 0.3.0, 0.2.1, 0.2.0
>
>         Attachments: hama-307.patch
>
>
> The nextJobId (int attribute) in BSPMaster is not read and updated atomically, therefore it's possible that concurrent requests get the same job ID and/or cause the job ID to not get incremented by the proper quantity.
> The following simple patch fixes it.
> Notice:
> I changed the type from int to Integer.
> This is to avoid doing the following in getNewJobId():
> int id;
> synchronized (this) {
>   id = nextJobId++;
> }
> the instance (referenced by this) is synchronized in many places in BSPMaster, so by making nextJobId an Integer (object), we can synchronize on it, reducing contention times:
> private Integer nextJobId = Integer.valueOf(1);
> public BSPJobID getNewJobId() throws IOException {
>     int id;
>     synchronized (nextJobId) {
>       id = nextJobId;
>       nextJobId = Integer.valueOf(id + 1);
>     }
>     return new BSPJobID(this.masterIdentifier, id);
>   }
> cheers

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HAMA-307) BSPMaster - job ID counter is not read and updated atomically

Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HAMA-307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920920#action_12920920 ] 

Filipe Manana commented on HAMA-307:
------------------------------------

Done :)

> BSPMaster - job ID counter is not read and updated atomically
> -------------------------------------------------------------
>
>                 Key: HAMA-307
>                 URL: https://issues.apache.org/jira/browse/HAMA-307
>             Project: Hama
>          Issue Type: Bug
>          Components: bsp
>    Affects Versions: 0.2.0
>            Reporter: Filipe Manana
>             Fix For: 0.3.0, 0.2.1, 0.2.0
>
>         Attachments: hama-307.patch
>
>
> The nextJobId (int attribute) in BSPMaster is not read and updated atomically, therefore it's possible that concurrent requests get the same job ID and/or cause the job ID to not get incremented by the proper quantity.
> The following simple patch fixes it.
> Notice:
> I changed the type from int to Integer.
> This is to avoid doing the following in getNewJobId():
> int id;
> synchronized (this) {
>   id = nextJobId++;
> }
> the instance (referenced by this) is synchronized in many places in BSPMaster, so by making nextJobId an Integer (object), we can synchronize on it, reducing contention times:
> private Integer nextJobId = Integer.valueOf(1);
> public BSPJobID getNewJobId() throws IOException {
>     int id;
>     synchronized (nextJobId) {
>       id = nextJobId;
>       nextJobId = Integer.valueOf(id + 1);
>     }
>     return new BSPJobID(this.masterIdentifier, id);
>   }
> cheers

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HAMA-307) BSPMaster - job ID counter is not read and updated atomically

Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HAMA-307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filipe Manana updated HAMA-307:
-------------------------------

          Component/s: bsp
        Fix Version/s: 0.2.0
                       0.2.1
                       0.3.0
    Affects Version/s: 0.2.0

> BSPMaster - job ID counter is not read and updated atomically
> -------------------------------------------------------------
>
>                 Key: HAMA-307
>                 URL: https://issues.apache.org/jira/browse/HAMA-307
>             Project: Hama
>          Issue Type: Bug
>          Components: bsp
>    Affects Versions: 0.2.0
>            Reporter: Filipe Manana
>             Fix For: 0.3.0, 0.2.1, 0.2.0
>
>         Attachments: hama-307.patch
>
>
> The nextJobId (int attribute) in BSPMaster is not read and updated atomically, therefore it's possible that concurrent requests get the same job ID and/or cause the job ID to not get incremented by the proper quantity.
> The following simple patch fixes it.
> Notice:
> I changed the type from int to Integer.
> This is to avoid doing the following in getNewJobId():
> int id;
> synchronized (this) {
>   id = nextJobId++;
> }
> the instance (referenced by this) is synchronized in many places in BSPMaster, so by making nextJobId an Integer (object), we can synchronize on it, reducing contention times:
> private Integer nextJobId = Integer.valueOf(1);
> public BSPJobID getNewJobId() throws IOException {
>     int id;
>     synchronized (nextJobId) {
>       id = nextJobId;
>       nextJobId = Integer.valueOf(id + 1);
>     }
>     return new BSPJobID(this.masterIdentifier, id);
>   }
> cheers

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HAMA-307) BSPMaster - job ID counter is not read and updated atomically

Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HAMA-307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filipe Manana updated HAMA-307:
-------------------------------

    Attachment: hama-307.patch

> BSPMaster - job ID counter is not read and updated atomically
> -------------------------------------------------------------
>
>                 Key: HAMA-307
>                 URL: https://issues.apache.org/jira/browse/HAMA-307
>             Project: Hama
>          Issue Type: Bug
>            Reporter: Filipe Manana
>         Attachments: hama-307.patch
>
>
> The nextJobId (int attribute) in BSPMaster is not read and updated atomically, therefore it's possible that concurrent requests get the same job ID and/or cause the job ID to not get incremented by the proper quantity.
> The following simple patch fixes it.
> Notice:
> I changed the type from int to Integer.
> This is to avoid doing the following in getNewJobId():
> int id;
> synchronized (this) {
>   id = nextJobId++;
> }
> the instance (referenced by this) is synchronized in many places in BSPMaster, so by making nextJobId an Integer (object), we can synchronize on it, reducing contention times:
> private Integer nextJobId = Integer.valueOf(1);
> public BSPJobID getNewJobId() throws IOException {
>     int id;
>     synchronized (nextJobId) {
>       id = nextJobId;
>       nextJobId = Integer.valueOf(id + 1);
>     }
>     return new BSPJobID(this.masterIdentifier, id);
>   }
> cheers

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.