Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gecko Bug 1682762] Handle byte addresses in stash server. #26976

Closed
wants to merge 3 commits into from

Conversation

moz-wptsync-bot
Copy link
Collaborator

Python 3.9 introduces a change like:

--- a/usr/lib64/python3.8/multiprocessing/connection.py
+++ b/usr/lib64/python3.9/multiprocessing/connection.py
@@ -73,6 +73,11 @@ def arbitrary_address(family):
     if family == 'AF_INET':
         return ('localhost', 0)
     elif family == 'AF_UNIX':
+        # Prefer abstract sockets if possible to avoid problems with the address
+        # size.  When coding portable applications, some implementations have
+        # sun_path as short as 92 bytes in the sockaddr_un struct.
+        if util.abstract_sockets_supported:
+            return f"\0listener-{os.getpid()}-{next(_mmap_counter)}"
         return tempfile.mktemp(prefix='listener-', dir=util.get_temp_dir())
     elif family == 'AF_PIPE':
         return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-' %

Which means that we can get byte addresses for abstract sockets. Encode
them to ascii so that we can pass it around in the environment or what
not.

Differential Revision: https://phabricator.services.mozilla.com/D99875

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1682762
gecko-commit: f2f341c6d43cfb9e8d4cdc37c922d814e57c7e20
gecko-reviewers: jgraham

Python 3.9 introduces a change like:

```
--- a/usr/lib64/python3.8/multiprocessing/connection.py
+++ b/usr/lib64/python3.9/multiprocessing/connection.py
@@ -73,6 +73,11 @@ def arbitrary_address(family):
     if family == 'AF_INET':
         return ('localhost', 0)
     elif family == 'AF_UNIX':
+        # Prefer abstract sockets if possible to avoid problems with the address
+        # size.  When coding portable applications, some implementations have
+        # sun_path as short as 92 bytes in the sockaddr_un struct.
+        if util.abstract_sockets_supported:
+            return f"\0listener-{os.getpid()}-{next(_mmap_counter)}"
         return tempfile.mktemp(prefix='listener-', dir=util.get_temp_dir())
     elif family == 'AF_PIPE':
         return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-' %
```

Which means that we can get byte addresses for abstract sockets. Encode
them to ascii so that we can pass it around in the environment or what
not.

Differential Revision: https://phabricator.services.mozilla.com/D99875

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1682762
gecko-commit: f2f341c6d43cfb9e8d4cdc37c922d814e57c7e20
gecko-reviewers: jgraham
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Firefox project.

@jgraham jgraham closed this Jan 22, 2021
@jgraham jgraham reopened this Jan 22, 2021
@saschanaz saschanaz closed this Jan 28, 2021
@saschanaz saschanaz reopened this Jan 28, 2021
@ghostd
Copy link
Contributor

ghostd commented Jan 29, 2021

Any idea why only the Mac tests fail? The patch is a python 3.9 change and the tests seem fine for Windows (whatever the python version)

@saschanaz
Copy link
Member

The sync is done in #27228, closing.

@saschanaz saschanaz closed this Jan 29, 2021
@saschanaz saschanaz deleted the gecko/1682762 branch January 29, 2021 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants