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

Appium Server stops after the device-farm plugin executes a method isValidStorageFileContent() #771

Open
dorogova-snezhana opened this issue Aug 20, 2023 · 19 comments
Labels
bug Something isn't working

Comments

@dorogova-snezhana
Copy link

Describe the bug

  1. Start Appium with device-farm plugin
  2. Create a new driver session
  3. Execute test steps and quit the driver.
  4. After executing a method DELETE /wd/hub/session/b5e5431e-b741-4cb2-9080-6e6c08239cce the device-farm plugin executes a method isValidStorageFileContent() with failure and Appium Server stops.
2023-08-20 14:58:14:677 - uncaughtException: [node-persist][readFile] /Users/sydorogova/.cache/appium-device-farm/storage/c9f82560afc787af5f0673262f55e4a2 does not look like a valid storage file!
Error: [node-persist][readFile] /Users/sydorogova/.cache/appium-device-farm/storage/c9f82560afc787af5f0673262f55e4a2 does not look like a valid storage file!
    at /Users/sydorogova/.appium/node_modules/appium-device-farm/node_modules/node-persist/src/local-storage.js:316:89
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

Link to Appium logs

GIST

Environment

  1. Appium 2.1.0
  2. Driver [email protected]
  3. Plugin [email protected]
  4. Node.js v18.16.0
  5. Npm 9.5.1
  6. Emulator command: ${ANDROID_HOME}/emulator/emulator -avd Pixel7Pro_API33_13.0 -no-boot-anim -no-audio -netdelay none -netspeed full
@deepakarorawins
Copy link

deepakarorawins commented Aug 22, 2023

For me it worked by setting environment variable as mentioned in trouble shooting document: https://appium-device-farm-eight.vercel.app/troubleshooting/

export GO_IOS="/opt/homebrew/lib/node_modules/go-ios/dist/go-ios-darwin-amd64_darwin_amd64/ios"

export PATH=$JAVA_HOME/bin:$GROOVY_HOME/bin:$GO_IOS:$PATH

@saikrishna321
Copy link
Member

@dorogova-snezhana Will fix this problem. In the mean time as a workaround can you delete the file manually /Users/sydorogova/.cache/appium-device-farm/storage/c9f82560afc787af5f0673262f55e4a2

@saikrishna321
Copy link
Member

@Dileep17

@dorogova-snezhana
Copy link
Author

dorogova-snezhana commented Aug 23, 2023

@saikrishna321 I've removed all files from directory /Users/sydorogova/.cache/appium-device-farm/storage and run tests. The Appium server is alive after the quit method execution. Tested on iOS and Android virtual devices.

@saikrishna321
Copy link
Member

This is expected driver.quit() will only end the session and not stop the server

@dorogova-snezhana
Copy link
Author

It is perfect to stop a session only. The main goal is to start the Appium server and run tests in parallel on multiple virtual devices. After each test we stop session and create a new one to reinstall the app.

@saikrishna321
Copy link
Member

Yes this is a good approach.

@luprochazka-cen63872
Copy link

@saikrishna321 Do you plan to fix this bug? I see the same behavior.

@saikrishna321
Copy link
Member

@luprochazka-cen63872 Can you share full logs please when this error occurs?

@afathonih
Copy link
Contributor

afathonih commented Jun 21, 2024

This bug started biting me again recently.
I think we can drop localStorage(since it's actually never used) and eventually also remove nodepersist from the equation.
Itried it in my PR last year. It was working OK.I used the branch for months.

@luprochazka-cen63872
Copy link

@luprochazka-cen63872 Can you share full logs please when this error occurs?

It is not necessary, in latest version it works without this problem. Thank you.

@saikrishna321
Copy link
Member

@afathonih We have plans to remove this localStorage. Will do it soon.

@saikrishna321 saikrishna321 added the bug Something isn't working label Jun 21, 2024
@Jitu1888
Copy link

�[38;5;112m[Appium]�[0m Appium REST http interface listener started on http://127.0.0.1:28224/wd/hub
�[38;5;112m[Appium]�[0m Available drivers:
�[38;5;112m[Appium]�[0m - [email protected] (automationName 'UiAutomator2')
�[38;5;112m[Appium]�[0m Available plugins:
�[38;5;112m[Appium]�[0m - [email protected] (ACTIVE)
�[38;5;112m[Appium]�[0m - [email protected]
�[38;5;112m[Appium]�[0m - [email protected]
�[38;5;112m[Appium]�[0m - [email protected]
�[38;5;112m[Appium]�[0m - [email protected]
�[38;5;112m[Appium]�[0m - [email protected] (ACTIVE)
�[38;5;112m[Appium]�[0m - [email protected]
�[0m Welcome to Appium v2.11.5 (REV After few test cases i m getting the below error
Error: [node-persist][readFile] /home/jenkins/.cache/appium-device-farm/storage/0d7d8b0b48168712087810d0a1eb0d42 does not look like a valid storage file!
at /home/jenkins/.appium/node_modules/node-persist/src/local-storage.js:316:89
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
at FSReqCallback.callbackTrampoline (node:internal/async_hooks:130:17)
Error: [node-persist][readFile] /home/jenkins/.cache/appium-device-farm/storage/0d7d8b0b48168712087810d0a1eb0d42 does not look like a valid storage file!
at /home/jenkins/.appium/node_modules/node-persist/src/local-storage.js:316:89
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
at FSReqCallback.callbackTrampoline (node:internal/async_hooks:130:17)

@Jitu1888
Copy link

@saikrishna321 how to handle it ?

@saikrishna321
Copy link
Member

@Jitu1888 you can delete the file under storage directory and this should solve the issue!

@Jitu1888
Copy link

@saikrishna321 I m running around 200 scripts , after 100 test cases then it came. I cant keep tracking the jenkins run.

@saikrishna321
Copy link
Member

@Jitu1888 we will fix this and move to DB.

@Jitu1888
Copy link

@saikrishna321 last help. even the below error is alson coming randomly {},"keepAliveMsecs":60000,"keepAlive":true,"maxSockets":null,"maxFreeSockets":256,"scheduling":"lifo","maxTotalSockets":null,"totalSocketCount":1},"httpsAgent":{"_events":{},"_eventsCount":2,"defaultPort":443,"protocol":"https:","options":{"rejectUnauthorized":false,"keepAlive":true,"keepAliveMsecs":60000,"path":null},"requests":{},"sockets":{},"freeSockets":{},"keepAliveMsecs":60000,"keepAlive":true,"maxSockets":null,"maxFreeSockets":256,"scheduling":"lifo","maxTotalSockets":null,"totalSocketCount":0,"maxCachedSessions":100,"_sessionCache":{"map":{},"list":[]}},"data":"{"capabilities":{"firstMatch":[{}],"alwaysMatch":{"appium:adbExecTimeout":60000,"appium:appActivity":"com.games24x7.coregame.common.deeplink.DeepLinkActivity -e \"setup_string\" \"https://docker-agu354.fickle.rummycircle.com/\\\" -e \"build_mode\" \"BUILD_WITH_URL\" -e pocoEnvData \"{\\\"serverIp\\\": \\\"10.224.108.235\\\", \\\"serverPort\\\": \\\"7900\\\"}\" ","appium:appPackage":"apps.rummycircle.com.mobilerummy.stage","appium:appWaitForLaunch":false,"appium:autoAcceptAlerts":true,"appium:autoGrantPermissions":true,"appium:automationName":"UIAutomator2","appium:chromeOptions":{"w3c":false},"appium:enableMultiWindows":true,"appium:enableWebviewDetailsCollection":true,"appium:newCommandTimeout":1200,"appium:noReset":false,"appium:noSign":true,"appium:session-override":"true","appium:skipServerInstallation":false,"appium:uiautomator2ServerInstallTimeout":90000,"appium:uiautomator2ServerLaunchTimeout":90000,"appium:uninstallOtherPackages":"apps.rummycircle.com.mobilerummy.stage, com.games24x7.rummycircle.rummy.stage, apps.rummycircle.com.mobilerummy, com.games24x7.rummycircle.rummy, com.my11circle.android.stage, com.games24x7.my11circle.fantasycricket.stage, com.games24x7.my11circle.fantasycricket, com.pokercircle.android.stage, io.appium.uiautomator2.server, io.appium.uiautomator2.server.test","browserName":"","platformName":"ANDROID","appium:pCloudy_DeviceVersion":"dummy","appium:pCloudy_DeviceManufacturer":"dummy","appium:udid":"RZ8TA114VMF","appium:platform":"android","appium:pCloudy_DeviceFullName":"RZ8TA114VMF"},"pendingSessionId":"29925335-3b15-44c7-8ea6-e6fc2954cb68"}}"},"code":"ECONNABORTED"}
2024-11-23 08:02:48:545 �[38;5;-140m[device-farm-/home/jenkins/.appium] Error while creating session: undefined
2024-11-23 08:02:48:550 �[38;5;-140m[device-farm-/home/jenkins/.appium] 📱 29925335-3b15-44c7-8ea6-e6fc2954cb68 Session response: {}
2024-11-23 08:02:48:550 �[38;5;-140m[device-farm-/home/jenkins/.appium] 📱 Removing pending session with capability_id: 29925335-3b15-44c7-8ea6-e6fc2954cb68
2024-11-23 08:02:48:555 �[38;5;-140m[device-farm-/home/jenkins/.appium] 29925335-3b15-44c7-8ea6-e6fc2954cb68 📱 Device UDID a130eb91-fff7-4f9a-bfe5-5dcca4cedaf1 unblocked. Reason: Failed to create session
2024-11-23 08:02:48:560 [AppiumDriver@82a4] Command 'createSession' was not handled by the following behaviours or plugins, even though they were registered to handle it: ["default"]. The command was handled by these: ["device-farm"].
2024-11-23 08:02:48:562 [AppiumDriver@82a4] Encountered internal error running command: Error: Unknown error while creating session
at Ot.generator (/home/jenkins/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/plugin.js:458:24)
at Generator.throw ()
at OB (/home/jenkins/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/plugin.js:29:47)
2024-11-23 08:02:48:565 [HTTP] <-- POST /wd/hub/session 500 60048 ms - 634
2024-11-23 08:02:48:706 [HTTP] Request idempotency key: da750786-9ff9-4acd-abe6-937fc43469a4
2024-11-23 08:02:48:707 [HTTP] --> POST /wd/hub/session {"capabilities":{"firstMatch":[{}],"alwaysMatch":

@Jitu1888
Copy link

@saikrishna321 can you please help me ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants