potiuk opened a new pull request, #24981:
URL: https://github.com/apache/airflow/pull/24981

   We keep on having repeated issue reports about non-matching
   hostname of workers. This seems to be trceable to getfqdn method
   of socket in Kubernetes that in some circumstances (race condition
   with netwrking setup when starting) can return different hostname
   at different times.
   
   There seems to be a related issue in Python that has not been
   resolved in more than 13 years (!)
   
   https://github.com/python/cpython/issues/49254
   
   The error seems to be related to the way how canonicalname is
   derived by getfqdn (it uses gethostbyaddr which sometimes
   provides different name than canonical name (it returns the
   first DNS name resolved that contains ".").
   
   We are fixing it in two ways:
   
   * instead of using gethostbyaddr we are using getadddrinfo with
     AI_CANONNAME flag which (according to the docs):
   
     https://man7.org/linux/man-pages/man3/getaddrinfo.3.html
   
       If hints.ai_flags includes the AI_CANONNAME flag, then the
       ai_canonname field of the first of the addrinfo structures in the
       returned list is set to point to the official name of the host.
   
   * we are caching the name returned by first time retrieval per
     interpreter. This way at least inside the same interpreter, the
     name of the host should not change.
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)**
 for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a 
newsfragment file, named `{pr_number}.significant.rst` or 
`{issue_number}.significant.rst`, in 
[newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to