You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by "Jie Yu (JIRA)" <ji...@apache.org> on 2014/04/09 02:57:14 UTC

[jira] [Created] (MESOS-1201) Store IP addresses in host order

Jie Yu created MESOS-1201:
-----------------------------

             Summary: Store IP addresses in host order
                 Key: MESOS-1201
                 URL: https://issues.apache.org/jira/browse/MESOS-1201
             Project: Mesos
          Issue Type: Bug
            Reporter: Jie Yu


Currently, in our code base, we store ip addresses in network order. For instance, in UPID. Ironically, we store ports in host order.

This can cause some subtle bugs which will be very hard to debug. For example, we store ip in MasterInfo. Say the IP address is: 01.02.03.04. Since we don't convert it into host order in our code, on x86 (little endian), it's integer value will be 0x04030201. Now, we store it as an uint32 field in MasterInfo protobuf. Protobuf will convert all integers into little endian format, since x86 is little endian machine, no conversion will take place. As a result, the value stored in probobuf will be 0x04030201. Now, if a big endian machine reads this protobuf, it will do the conversion. If it later interprets the ip from this integer, it will interpret it to be 04.03.02.01.

So I plan to store all IP addresses in our code base to be in host order (which is the common practice).

We may have some compatibility issues as we store MasterInfo in ZooKeeper for master detection and redirection. For example, what if the new code reads an old MasterInfo? What would happen?





--
This message was sent by Atlassian JIRA
(v6.2#6252)