nchammas / flintrock

A command-line tool for launching Apache Spark clusters.
Apache License 2.0
636 stars 116 forks source link

Flintrock throws an exception when "checkip" returns multiple IP addresses #271

Closed boechat107 closed 5 years ago

boechat107 commented 5 years ago

For the network I'm in, "checkip" returns multiple IP addresses separated by commas. Flintrock just adds a subnet mask and tries to create the security group rules. Then I get the following exception:

botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the AuthorizeSecurityGroupIngress operation: CI$
R block <IP addresses> is malformed

Line where the exception is thrown: https://github.com/nchammas/flintrock/blob/master/flintrock/ec2.py#L600

Might a simple solution be just splitting the string and using only the first IP?

nchammas commented 5 years ago

Thanks for reporting this.

Indeed, it seems that just splitting the result returned here would be sufficient, but I'm curious to understand under what circumstances multiple addresses are returned and what they mean.

Can you share some examples of what you get when multiple addresses are returned? Do you know what the difference is between the various returned addresses?

boechat107 commented 5 years ago

These are good questions, but I don't have good answers to them. I guess it is the ISP provider doing NAT on outbound connections. So, getting the public address is almost unpredictable... Does it make sense?

The problem happened only once so far, when I was working from a specific network. I confess I didn't check if the IPs made any sense.

I submitted the issue because I was unable to launch a cluster. However, thinking better now, I'm not sure if I would be able to do it even if this issue was fixed.

nchammas commented 5 years ago

I posted a question about this on Stack Overflow to see if we can get more information about what's going on here.

boechat107 commented 5 years ago

OK. I've also searched for answers on Stack Overflow before, but I still don't know exactly what happened. I know that the network I was in has at least two different ISPs.

I'm also not sure about the influence of request headers. From my home network, these are screenshots using two different browsers, Opera and Firefox:

screenshot_2018-10-04_12-36-42

screenshot_2018-10-04_12-53-06

They used slightly different headers.

Using curl I get the same response as Firefox.