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)

Reply via email to