Pytorch distributed init_process_group hangs when using a custom port

Hi. I am trying to use Pytorch distributed but strangely when calling init_process_group using a custom port by setting os.environ['MASTER_PORT'] in Pytorch 1.10.1, it hangs but not in Pytorch 1.8. The initialization works well if I don’t set a custom port. Do you have any idea about this?

Can you provide a small code snippet for us to repro the issue?

cc @H-Huang @kwen2501