Skip to content

[🐛 Bug]: Appium port is already be in use #14017

@Edgar56

Description

@Edgar56

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

v21.7.1

Mode

Standalone Mode

Which capabilities are you using?

{
  maxInstances: 1,
    platformName: 'iOS',
    port: 4723,
    'appium:platformName': 'iOS',
    'appium:deviceName': 'iPhone 15 Pro',
    'appium:platformVersion': '17.4',
    'appium:automationName': 'XCUITest',
    'appium:app': 'app/location' ,
    'appium:language': 'en',
    'appium:locale': 'en_US',
    'appium:udid': 'auto',
    acceptInsecureCerts: true,
    timeouts: { implicit: 60000, pageLoad: 60000, script: 60000 },
}

Same for Android

What happened?

First time when I run test appium server is up and running.
Second time when I run test I get error:

2024-12-30T14:26:29.285Z ERROR @wdio/appium-service: [HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.

2024-12-30T14:26:29.286Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
Error: [HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.

Before I had 9.4.1 version everything was fine

What is your expected behavior?

Each time when I run test port shouldn't be used by appium

How to reproduce the bug.

Simple test to open simple app will be enough, the issue with appium server itself

Relevant log output

2024-12-30T14:26:28.216Z INFO @wdio/cli:launcher: Run onPrepare hook
2024-12-30T14:26:28.218Z INFO @wdio/appium-service: Will spawn Appium process: appium --base-path / --log ./logs/wdio-appium_android1.log --debug-log-spacing --session-override --port 4724 --allow-insecure chromedriver_autodownload
2024-12-30T14:26:29.285Z ERROR @wdio/appium-service: [HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.

2024-12-30T14:26:29.286Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
Error: [HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.

    at Socket.onErrorMessage (file:///*/node_modules/@wdio/appium-service/build/index.js:200:20)
    at Object.onceWrapper (node:events:634:26)
    at Socket.emit (node:events:519:28)
    at Socket.emit (node:domain:488:12)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

Continue...
2024-12-30T14:26:29.286Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2024-12-30T14:26:29.287Z INFO @wdio/local-runner: Start worker 0-0 with arg: run ./wdio.conf.ts test --android --spec tests/specs/android/test.spec.ts
2024-12-30T14:26:29.291Z ERROR @wdio/appium-service: Appium exited before timeout (exit code: 1)
[HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.

2024-12-30T14:26:36.909Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2024-12-30T14:26:36.910Z INFO @wdio/local-runner: Shutting down spawned worker
2024-12-30T14:26:37.162Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions