[
https://issues.apache.org/jira/browse/MESOS-815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13825709#comment-13825709
]
Benjamin Mahler commented on MESOS-815:
---------------------------------------
{noformat}
commit ce431373541ecfc998bc67347276e53c41615e0b
Author: Benjamin Mahler <[email protected]>
Date: Sat Nov 16 16:13:31 2013 -0800
Fixed the thread-safety of process::ID::generate.
Review: https://reviews.apache.org/r/15628
{noformat}
> Race condition in process::ID::generate().
> ------------------------------------------
>
> Key: MESOS-815
> URL: https://issues.apache.org/jira/browse/MESOS-815
> Project: Mesos
> Issue Type: Bug
> Components: c++ api
> Environment: Linux gcc-4.2.1
> Reporter: Jie Yu
> Assignee: Benjamin Mahler
> Fix For: 0.15.0
>
>
> string generate(const string& prefix)
> {
> static map<string, int> prefixes;
> stringstream out;
> out << __sync_add_and_fetch(&prefixes[prefix], 1);
> return prefix + "(" + out.str() + ")";
> }
> This function could be called from multiple threads and the std::map
> 'prefixes' is not protected by lock, leading to a race condition. This causes
> framework to segfault.
--
This message was sent by Atlassian JIRA
(v6.1#6144)