Skip to content

gh-128627: Fix iPad detection in wasm-gc #135388

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

Merged
merged 2 commits into from
Jun 12, 2025

Conversation

ryanking13
Copy link
Contributor

@ryanking13 ryanking13 commented Jun 11, 2025

As of iOS / iPadOS 18.3.1, enabling wasm-gc is making the interpreter fail to load.

This issue was handled by @ambv in #130418, but that fix had an issue with not detecting the iPad correctly.
In iPad + Safari, iPad behaves like a Mac and checking iPad string in navigator.platform fails to detect iPad.

Confirmed on device + downstream PR (pyodide/pyodide#5695)

cc: @hoodmane @WebReflection

@bedevere-app
Copy link

bedevere-app bot commented Jun 11, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@hoodmane
Copy link
Contributor

While we're at it maybe let's add links to the relevant webkit issue and the fix:
https://bugs.webkit.org/show_bug.cgi?id=293113
WebKit/WebKit#46379

@hoodmane hoodmane requested a review from freakboy3742 June 11, 2025 16:08
@hoodmane
Copy link
Contributor

Otherwise looks good to me. Thanks @ryanking13!

@hoodmane
Copy link
Contributor

Maybe we should also add a comment saying this code is only needed to make jspi work and since jspi is not yet supported on Safari it would be okay to turn it off for desktop Safari as well if we need to.

Copy link
Contributor

@hoodmane hoodmane left a comment

Choose a reason for hiding this comment

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

Thanks!

// Starting with iPadOS 13, iPads might send a platform string that looks like a desktop Mac.
// To differentiate, we check if the platform is 'MacIntel' (common for Macs and newer iPads)
// AND if the device has multi-touch capabilities (navigator.maxTouchPoints > 1)
(navigator.platform === 'MacIntel' && typeof navigator.maxTouchPoints !== 'undefined' && navigator.maxTouchPoints > 1)

Choose a reason for hiding this comment

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

duplicated same-comment here: pyodide/pyodide#5695 (review)

@freakboy3742 freakboy3742 added the needs backport to 3.14 bugs and security fixes label Jun 12, 2025
Copy link
Contributor

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

Added in a reference to the radar and CPython issues, but otherwise, LGTM.

@freakboy3742 freakboy3742 enabled auto-merge (squash) June 12, 2025 03:38
@freakboy3742 freakboy3742 merged commit d447129 into python:main Jun 12, 2025
38 checks passed
@miss-islington-app
Copy link

Thanks @ryanking13 for the PR, and @freakboy3742 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 12, 2025
On some iPad versions, Safari reports as "macOS". Modifies the GC trampoline detection
to add a feature-based check to detect this case.
(cherry picked from commit d447129)

Co-authored-by: Gyeongjae Choi <def6488@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Jun 12, 2025

GH-135419 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jun 12, 2025
freakboy3742 pushed a commit that referenced this pull request Jun 12, 2025
On some iPad versions, Safari reports as "macOS". Modifies the GC trampoline detection
to add a feature-based check to detect this case.
(cherry picked from commit d447129)

Co-authored-by: Gyeongjae Choi <def6488@gmail.com>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 RHEL8 Refleaks 3.14 (tier-1) has failed when building commit e76dbc8.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1795/builds/170) and take a look at the build logs.
  4. Check if the failure is related to this commit (e76dbc8) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1795/builds/170

Failed tests:

  • test.test_multiprocessing_fork.test_processes

Failed subtests:

  • test_interrupt - test.test_multiprocessing_fork.test_processes.WithProcessesTestProcess.test_interrupt

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 588, in test_interrupt
    exitcode = self._kill_process(multiprocessing.Process.interrupt)
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 570, in _kill_process
    self.assertEqual(join(), None)
                     ~~~~^^
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 250, in __call__
    return self.func(*args, **kwds)
           ~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/multiprocessing/process.py", line 156, in join
    res = self._popen.wait(timeout)
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 44, in wait
    return self.poll(os.WNOHANG if timeout == 0.0 else 0)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 28, in poll
    pid, sts = os.waitpid(self.pid, flag)
               ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 566, in handler
    raise RuntimeError('join took too long: %s' % p)
RuntimeError: join took too long: <Process name='Process-931' pid=3787289 parent=3781804 started daemon>


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 588, in test_interrupt
    exitcode = self._kill_process(multiprocessing.Process.interrupt)
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 570, in _kill_process
    self.assertEqual(join(), None)
                     ~~~~^^
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 250, in __call__
    return self.func(*args, **kwds)
           ~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/multiprocessing/process.py", line 156, in join
    res = self._popen.wait(timeout)
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 44, in wait
    return self.poll(os.WNOHANG if timeout == 0.0 else 0)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 28, in poll
    pid, sts = os.waitpid(self.pid, flag)
               ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 566, in handler
    raise RuntimeError('join took too long: %s' % p)
RuntimeError: join took too long: <Process name='Process-3' pid=3894134 parent=3894130 started daemon>


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/multiprocessing/process.py", line 320, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.14.cstratak-RHEL8-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 518, in _sleep_some_event
    time.sleep(100)
    ~~~~~~~~~~^^^^^
KeyboardInterrupt
k

@freakboy3742
Copy link
Contributor

Buildbot failure is a false positive.

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.

5 participants