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

bug:: TypeError: Cannot perform 'get' on a proxy that has been revoked #20290

Open
3 tasks done
gointoit opened this issue Jun 24, 2024 · 16 comments
Open
3 tasks done

bug:: TypeError: Cannot perform 'get' on a proxy that has been revoked #20290

gointoit opened this issue Jun 24, 2024 · 16 comments
Labels
ThirdParty upstream problems XCUITest regarding xcuitest driver

Comments

@gointoit
Copy link

Do I have the most recent component updates?

  • I use the most recent available driver/plugin and server versions

Is the component officially supported by the Appium team?

  • I have verified the component repository is present under the Appium organization in GitHub

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

image

Expected Behavior

can connect success

Minimal Reproducible Example

xcode 15.4
{ "platformName": "ios", "appium:platformVersion": "16.0", "appium:deviceName": "iPhone 13", "appium:noReset": true, "appium:bundleId": "com.apple.mobilesafari", "appium:automationName": "XCuiTest", "settings:snapshotMaxDepth": 40, "appium:udid": "00008110-001404C12622801E", "appium:wdaLocalPort": "8102", "appium:usePreinstalledWDA": true, "appium:updatedWDABundleId": "com.shopee.infra.automation.WebDriverAgentRunner" }

I have changed several phones and all of them have this problem. Accompanied by this error, appium will exit abnormally

Environment

  • Operating system: Apple M1 Pro 14.5
  • Appium server version (output of appium --version): 2.10.3
  • Appium driver(s) and their version(s) (appium driver list): [email protected]
  • Appium plugin(s) and their version(s) (appium plugin list): [email protected]
  • Node.js version (output of node --version): v22.2.0
  • npm version (output of npm --version): 10.7.0
  • Last component(s) version which did not exhibit the problem: i don't know
  • Platform and version under test: I tried several different versions of iPhones, all with the same error
  • Real device or emulator/simulator: Real device

Link to Appium Logs

No response

Further Information

appium.log
After the error occurred, appium exited abnormally

@gointoit gointoit added Bug a problem that needs fixing Needs Triage bugs which are not yet confirmed labels Jun 24, 2024
@mykola-mokhnach
Copy link
Collaborator

This is most likely happening because the

"appium:usePreinstalledWDA": true,

capability is enabled. Are you sure the system version of the device under test is 16?

@mykola-mokhnach mykola-mokhnach added Needs Info typically non-actionable; needs author to respond and removed Bug a problem that needs fixing Needs Triage bugs which are not yet confirmed labels Jun 24, 2024
@gointoit
Copy link
Author

This is most likely happening because the

"appium:usePreinstalledWDA": true,

capability is enabled. Are you sure the system version of the device under test is 16?

I am sure, all configurations are absolutely normal, WDA was also pre installed on the phone, Not only iOS 16.0, but also iOS 16.6 and iOS 16.3.1 are all the same errors,I suspect there may be compatibility issues under xcode 15.4?
I can run it normally on other computers(The WDA is also compiled by the corresponding computer), but the xcode version on other computers is 14.*

@gointoit
Copy link
Author

Why do I use xcode 15? It's because I want to test ios17, But before testing ios17, I want to verify if ios16 works properly in xcode 15, but it runs abnormally. 😭

@mykola-mokhnach
Copy link
Collaborator

mykola-mokhnach commented Jun 24, 2024

I can run it normally on other computers(The WDA is also compiled by the corresponding computer), but the xcode version on other computers is 14.*

You are right, this might be the culprit. Since iOS 17 Apple has completely changed the way the preinstalled WDA feature works, so we have switched to use of devicectl tool. Although this tool does not work for iOS devices running os version 16.

As a workaround you may:

  • Downgrade xCode to version 14 for iOS 16 devices and use version 15 only with iOS 17
  • Disable the usePreinstalledWDA feature for Xcode 15/iOS 16 combination

@mykola-mokhnach mykola-mokhnach added ThirdParty upstream problems XCUITest regarding xcuitest driver and removed Needs Info typically non-actionable; needs author to respond labels Jun 24, 2024
@mykola-mokhnach
Copy link
Collaborator

FYI @KazuCocoa

@gointoit
Copy link
Author

I can run it normally on other computers(The WDA is also compiled by the corresponding computer), but the xcode version on other computers is 14.*

You are right, this might be the culprit. Since iOS 17 Apple has completely changed the way the preinstalled WDA feature works, so we have switched to use of devicectl tool. Although this tool does not work for iOS devices running os version 16.

As a workaround you may:

  • Downgrade xCode to version 14 for iOS 16 devices and use version 15 only with iOS 17
  • Disable the usePreinstalledWDA feature for Xcode 15/iOS 16 combination

Thank you very much for your suggestion,I will verify ios17 on xcode15

@gointoit
Copy link
Author

I can run it normally on other computers(The WDA is also compiled by the corresponding computer), but the xcode version on other computers is 14.*

You are right, this might be the culprit. Since iOS 17 Apple has completely changed the way the preinstalled WDA feature works, so we have switched to use of devicectl tool. Although this tool does not work for iOS devices running os version 16.

As a workaround you may:

  • Downgrade xCode to version 14 for iOS 16 devices and use version 15 only with iOS 17
  • Disable the usePreinstalledWDA feature for Xcode 15/iOS 16 combination

I still fail when using iOS 17, but the error message has changed
appium.log

@mykola-mokhnach
Copy link
Collaborator

2024-06-24 18:57:38:787 - �[38;5;25m[XCUITestDriver@cdcd]�[0m Error: Failed to start the preinstalled WebDriverAgent in 60000 ms. The WebDriverAgent might not be properly built or the device might be locked. The 'appium:wdaLaunchTimeout' capability modifies the timeout.

Are you sure the prebuilt WDA works on the target device? Maybe try to manually run it using the command from the log:

2024-06-24 18:56:37:130 - �[38;5;25m[XCUITestDriver@cdcd]�[0m Executing xcrun devicectl device process launch --device 00008020-001804200E8A002E --terminate-existing --environment-variables '{"USE_PORT":"8105","WDA_PRODUCT_BUNDLE_IDENTIFIER":"com.shopee.infra.automation.WebDriverAgentRunner.xctrunner","MJPEG_SERVER_PORT":"9105"}' com.shopee.infra.automation.WebDriverAgentRunner.xctrunner

and then verify it's listening using curl http://<device_ip>:8105/status

@mykola-mokhnach
Copy link
Collaborator

Also check https://github.com/appium/appium-xcuitest-driver/blob/master/docs/guides/run-preinstalled-wda.md
Usually WDA package needs additional adjustments to run properly being preinstalled.

@KazuCocoa
Copy link
Member

for the first attached. I haven't seen the error case, but it looks like launching WDA succeeded once but it ended immediately.

2024-06-24 16:58:20:061 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone testmanagerd[30465] <Notice>: Process monitor update handler invoked for com.shopee.infra.automation.WebDriverAgentRunner.xctrunner
2024-06-24 16:58:20:061 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone testmanagerd[30465] <Notice>: Computed display ID com.shopee.infra.automation.WebDriverAgentRunner.xctrunner from embeddedApplicationIdentifier: com.shopee.infra.automation.WebDriverAgentRunner.xctrunner, xpcServiceIdentifier: (null), bundleID: com.shopee.infra.automation.WebDriverAgentRunner.xctrunner
2024-06-24 16:58:20:061 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone runningboardd(RunningBoard)[31] <Notice>: Assertion 31-30465-4889 (target:[application<com.shopee.infra.automation.WebDriverAgentRunner.xctrunner>:31424]) will be created as active
2024-06-24 16:58:20:061 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone testmanagerd[30465] <Notice>: Got reply for process assertion request, success: YES
2024-06-24 16:58:20:061 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone testmanagerd[30465] <Notice>: Got reply for process assertion request for pid 31424, success: YES
2024-06-24 16:58:20:062 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone testmanagerd[30465] <Notice>: <XCTDProcessMonitor: 0x107f087e0> passing update com.shopee.infra.automation.WebDriverAgentRunner.xctrunner@/private/var/containers/Bundle/Application/4090F275-199C-4C98-9186-8A52C9F32F8B/WebDriverAgentRunner-Runner.app pid: 31424 state: running background to <XCTDProcessManagementServicesProvider: 0x107f0a7c0>
2024-06-24 16:58:20:062 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone kernel[0] <Notice>: memorystatus: set assertion priority(100) target WebDriverAgentRunner-Runner:31424
2024-06-24 16:58:20:062 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone runningboardd(RunningBoard)[31] <Notice>: Attempting to rename power assertion 32964 for target application<com.shopee.infra.automation.WebDriverAgentRunner.xctrunner> to application<com.shopee.infra.automation.WebDriverAgentRunner.xctrunner>;31-30465-4889:Developer testing(BackgroundUI);31-32-4884:FBApplicationProcess
2024-06-24 16:58:20:062 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone runningboardd(RunningBoard)[31] <Notice>: Calculated state for application<com.shopee.infra.automation.WebDriverAgentRunner.xctrunner>: running-active (role: NonUserInteractive)
2024-06-24 16:58:20:062 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone testmanagerd[30465] <Notice>: <XCTestSession: 0x107f07140> pid 31424 com.shopee.infra.automation.WebDriverAgentRunner.xctrunner@/private/var/containers/Bundle/Application/4090F275-199C-4C98-9186-8A52C9F32F8B/WebDriverAgentRunner-Runner.app pid: 31424 state: running background
2024-06-24 16:58:20:062 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone runningboardd(RunningBoard)[31] <Notice>: [application<com.shopee.infra.automation.WebDriverAgentRunner.xctrunner>:31424] Set jetsam priority to 100 [0] flag[1]
2024-06-24 16:58:20:062 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone testmanagerd[30465] <Notice>: Computed display ID com.shopee.infra.automation.WebDriverAgentRunner.xctrunner from embeddedApplicationIdentifier: com.shopee.infra.automation.WebDriverAgentRunner.xctrunner, xpcServiceIdentifier: (null), bundleID: com.shopee.infra.automation.WebDriverAgentRunner.xctrunner
2024-06-24 16:58:20:062 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone runningboardd(RunningBoard)[31] <Notice>: [application<com.shopee.infra.automation.WebDriverAgentRunner.xctrunner>:31424] set Memory Limits to Hard Active (2098)
2024-06-24 16:58:20:062 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone testmanagerd[30465] <Notice>: <XCTDProcessMonitor: 0x107f087e0> passing update com.shopee.infra.automation.WebDriverAgentRunner.xctrunner@/private/var/containers/Bundle/Application/4090F275-199C-4C98-9186-8A52C9F32F8B/WebDriverAgentRunner-Runner.app pid: 31424 state: running background to <XCTDProcessManagementServicesProvider: 0x107f0a7c0>
2024-06-24 16:58:20:062 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone WebDriverAgentRunner-Runner(UIKitCore)[31424] <Notice>: sceneOfRecord: sceneID: sceneID:com.shopee.infra.automation.WebDriverAgentRunner.xctrunner-default  persistentID: 25880D4C-172B-4132-8EC9-83D9949C1106
2024-06-24 16:58:20:062 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone testmanagerd[30465] <Notice>: <XCTestSession: 0x107f07140> pid 31424 com.shopee.infra.automation.WebDriverAgentRunner.xctrunner@/private/var/containers/Bundle/Application/4090F275-199C-4C98-9186-8A52C9F32F8B/WebDriverAgentRunner-Runner.app pid: 31424 state: running background
2024-06-24 16:58:20:062 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone testmanagerd[30465] <Notice>: Test session EDE481AC-FC28-47D0-9278-2B65F30E360B requested transport for IDE
...
2024-06-24 16:58:20:064 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone backboardd(RunningBoardServices)[64] <Notice>: Received state update for 31424
2024-06-24 16:58:20:068 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone SpringBoard(FrontBoard)[32] <Notice>: [0x283eef190:(FBSceneManager):sceneID:com.shopee.infra.automation.WebDriverAgentRunner.xctrunner-default] Scene activity mode did change: suspended.
2024-06-24 16:58:20:068 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone SpringBoard(FrontBoard)[32] <Notice>: [0x283eef190:(FBSceneManager):sceneID:com.shopee.infra.automation.WebDriverAgentRunner.xctrunner-default] Scene assertion state did change: None.
2024-06-24 16:58:20:069 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone SpringBoard(FrontBoard)[32] <Notice>: [application<com.shopee.infra.automation.WebDriverAgentRunner.xctrunner>:31424] Launch assertion supersedes update of workspace assertion to BackgroundActive.
2024-06-24 16:58:20:069 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone SpringBoard(FrontBoard)[32] <Notice>: [application<com.shopee.infra.automation.WebDriverAgentRunner.xctrunner>:31424] Workspace assertion state did change: None (acquireAssertion = NO).
2024-06-24 16:58:20:069 - �[38;5;180m[ios-device]�[0m Test runner ready
2024-06-24 16:58:20:070 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone WebDriverAgentRunner-Runner(XCTestCore)[31424] <Error>: Error while preparing for testing: (null)
2024-06-24 16:58:20:070 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone SpringBoard(FrontBoard)[32] <Notice>: [application<com.shopee.infra.automation.WebDriverAgentRunner.xctrunner>:31424] Workspace connection invalidated.
2024-06-24 16:58:20:070 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone SpringBoard(FrontBoard)[32] <Notice>: [application<com.shopee.infra.automation.WebDriverAgentRunner.xctrunner>:31424] Now flagged as pending exit for reason: workspace client connection invalidated
2024-06-24 16:58:20:070 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone backboardd(IOKit)[64] <Notice>: Connection removed: IOHIDEventSystemConnection uuid:731DAF6B-D9AA-461B-A5FE-0B20060D19DC pid:31424 process:WebDriverAgentRunner-Runner type:Passive entitlements:0x0 caller:BackBoardServices: <redacted> + 280 attributes:{
2024-06-24 16:58:20:070 - �[38;5;111m[IOSDeviceLog]�[0m     HighFrequency = 1;
2024-06-24 16:58:20:070 - �[38;5;111m[IOSDeviceLog]�[0m     bundleID = "com.shopee.infra.automation.WebDriverAgentRunner.xctrunner";
2024-06-24 16:58:20:070 - �[38;5;111m[IOSDeviceLog]�[0m     pid = 31424;
2024-06-24 16:58:20:070 - �[38;5;111m[IOSDeviceLog]�[0m } state:0x1 events:0 mask:0x0 dropped:0 dropStatus:0 droppedMask:0x0 lastDroppedTime:NONE
2024-06-24 16:58:20:071 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone backboardd(BackBoardHIDEventFoundation)[64] <Notice>: Removing client connection <BKHIDClientConnection: 0x10785b610; IOHIDEventSystemConnectionRef: 0x107840fd0; vpid: 31424(v16F73); taskPort: 0x55EAB; bundleID: com.shopee.infra.automation.WebDriverAgentRunner.xctrunner> for client: IOHIDEventSystemConnection uuid:731DAF6B-D9AA-461B-A5FE-0B20060D19DC pid:31424 process:WebDriverAgentRunner-Runner type:Passive entitlements:0x0 caller:BackBoardServices: <redacted> + 280 attributes:{
2024-06-24 16:58:20:071 - �[38;5;111m[IOSDeviceLog]�[0m     HighFrequency = 1;
2024-06-24 16:58:20:071 - �[38;5;111m[IOSDeviceLog]�[0m     bundleID = "com.shopee.infra.automation.WebDriverAgentRunner.xctrunner";
2024-06-24 16:58:20:071 - �[38;5;111m[IOSDeviceLog]�[0m     pid = 31424;
2024-06-24 16:58:20:071 - �[38;5;111m[IOSDeviceLog]�[0m } state:0x1 events:0 mask:0x0 dropped:0 dropStatus:0 droppedMask:0x0 lastDroppedTime:NONE source:HID
2024-06-24 16:58:20:071 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone backboardd(HIDAnalytics)[64] <Notice>: HIDAnalytics Unregister Send event com.apple.hid.queueUsage
2024-06-24 16:58:20:071 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone testmanagerd[30465] <Notice>: Test process connection invalidated or interrupted, closing test session <XCTestSession: 0x107f07140> pid 31424.
2024-06-24 16:58:20:071 - �[38;5;111m[IOSDeviceLog]�[0m Jun 24 16:58:19 qijintekiiPhone testmanagerd[30465] <Notice>: Closed <XCTestSession: 0x107f07140> pid 31424, removing from (

for #20290 (comment) , it didn't have ios log, but I guess the mykola's link is the reason. I wondered if the for iOS 17 thing also helps for Xcode 15 x iOS 16

@gointoit
Copy link
Author

Also check https://github.com/appium/appium-xcuitest-driver/blob/master/docs/guides/run-preinstalled-wda.md Usually WDA package needs additional adjustments to run properly being preinstalled.

rm -rf WebDriverAgentRunner-Runner.app/Frameworks/XC*.framework
Through this method, the connection was successful 👏

@gointoit
Copy link
Author

gointoit commented Jun 26, 2024

Also check https://github.com/appium/appium-xcuitest-driver/blob/master/docs/guides/run-preinstalled-wda.md Usually WDA package needs additional adjustments to run properly being preinstalled.

rm -rf WebDriverAgentRunner-Runner.app/Frameworks/XC*.framework Through this method, the connection was successful 👏

Based on the above method, I tested iOS 17.5.1 and encountered a new issue where there may occasionally be permanent blocking when establishing a connection,then it couldn't be restored (maybe restarting the phone will restore it)

with showIOSLog = true, The complete log information is attached below. If the appium server is not closed, this log will continue to refresh, appearing like a dead end loop
appium.log

without showIOSLog = false, It will always block here and there will be no timeout exceptions and also there is no other log information available
appium.log

@mykola-mokhnach
Copy link
Collaborator

without showIOSLog = false, It will always block here and there will be no timeout exceptions and also there is no other log information available

It looks like an issue with Apple's devicectl tool. Although it should not be freezing, I would rather expect it to timeout instead.

@KazuCocoa
Copy link
Member

Agree, it looks like the devicectl tool related. Perhaps the command didn't issue any launching app command itself (based on the shared iOS log). I wondered if the devicectl messed up before sending launching app command to the device.

@gointoit
Copy link
Author

In order to find a stable testing solution for iOS 17,i try to use Attach to a Running WebDriverAgent as described in the document ,
The connection is stable, but I have encountered a new issue where an error message may appear during screen recording
it's my apppium param as below:

{
"appium:appInstallStrategy": "ios-deploy",
"appium:automationName": "XCuiTest",
"appium:bundleId": "com.beeasy.shopee.id.enterprise",
"appium:clearSystemFiles": true,
"appium:commandTimeouts": "230000",
"appium:iosInstallPause": 8000,
"appium:mjpegServerPort": 9102,
"appium:newCommandTimeout": 240,
"appium:noReset": true,
"appium:platformVersion": "17.5.1",
"appium:showIOSLog": false,
"appium:showXcodeLog": false,
"appium:skipLogCapture": true,
"appium:udid": "00008020-001804200E8A002E",
"appium:wdaBaseUrl": "http://localhost:8102",
"appium:wdaConnectionTimeout": 45000,
"appium:wdaStartupRetries": 4,
"appium:wdaStartupRetryInterval": 20000,
"platformName": "IOS"
}

and the appium log is:
appium.log

@KazuCocoa
Copy link
Member

If you haven't started the WDA process with environment variables, the port will be the default one.
e.g. with launching preinstalled WDA method case:
https://github.com/appium/WebDriverAgent/blob/d0c518ad4ac25a5b50508aeac94a1d734c7ed35a/lib/webdriveragent.js#L387-L393

Then, I guess you might need to use default 9100.

2024-06-27 18:58:41:760 - [aff807f6][ffmpeg]   libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100

2024-06-27 18:58:41:771 - [aff807f6][ffmpeg] [in#0 @ 0x600000ac8100] Error opening input: Connection reset by peer
Error opening input file http://localhost:9102.
Error opening input files: Connection reset by peer

2024-06-27 18:58:46:668 - [aff807f6][XCUITestDriver@c229] Screen capture process did not start within 5000ms. Continuing anyway
2024-06-27 18:58:46:669 - [aff807f6][DevCon Factory] Releasing connections for 00008020-001804200E8A002E device on 9102 port number
2024-06-27 18:58:46:669 - [aff807f6][DevCon Factory] No cached connections have been found
2024-06-27 18:58:46:672 - [aff807f6][XCUITestDriver@c229] Encountered internal error running command: Error: The screen capture process 'ffmpeg' died unexpectedly. Check server logs for more details
    at ScreenRecorder.start (/Users/qijin.xu/.appium/node_modules/appium-xcuitest-driver/lib/commands/recordscreen.js:129:13)
    at XCUITestDriver.startRecordingScreen (/Users/qijin.xu/.appium/node_modules/appium-xcuitest-driver/lib/commands/recordscreen.js:300:7)
2024-06-27 18:58:46:674 - [aff807f6][HTTP] <-- POST /session/aff807f6-a265-4756-9142-15d5ee0e795a/appium/start_recording_screen 500 5030 ms - 684

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ThirdParty upstream problems XCUITest regarding xcuitest driver
Projects
None yet
Development

No branches or pull requests

3 participants