appium / appium/java-client

Appium client hung waiting on socket read when server logs 404

Open
#1,665 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

Description:

I am writing tests using the Page Object Model pattern. I love the annotations. On iOS, I will occasionally see my test application hang when one of my annotated elements is referenced and the Appium server has logged a 404 for a stale element. It seems like it did not respond to the client with the error and the client hangs waiting for a response.

Environment:

  • java-client 7.4.1
  • Appium server: 2.0.0-beta.25
  • Desktop OS: macOS Monterey 12.1
  • Mobile platform: iOS 14.7.1
  • Real device iPhone SE

Details:

I am using Page Object Model features. In my implementation, I have a parent Page class which calls a waitForPageVisible function for each derived class. The waitForPageVisible method will reference one of my annotated variables which should result in appium doing its magic FindBy stuff.

e.g., my derived class has the following:

@AndroidFindBy(id = "com.co.android.apps.connectmobile:id/button_submit")  
@iOSXCUITFindBy(accessibility = "submit_button_id")  
@WithTimeout(time = WITH_TIMEOUT_MEDIUM, chronoUnit = ChronoUnit.SECONDS)  
lateinit var submitButton: MobileElement
  
override fun waitForPageVisible() {  
    submitButton.isDisplayed  
}

Stacktraces

When this function is called, I have seen cases where the client hangs with the following call stack. I am not familiar with the internals of the java client, but I do notice that the stack does not have any kind of wait loop that I could see which I would have expected given the annotations. But the stack indicates the program is stuck on the socket read waiting for a response.
gist of stacktrace

Appium logs

And my appium server log is displaying this message with the 404 and what appears to be an incomplete message ending in 3 dots.
gist of the end of the Appium server log

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the annotated element access in waitForPageVisible and the socket-read stack trace, then compare it with the Appium server's 404 log and incomplete response. Trace how the Java client handles that response; done means a stale-element error is returned to the test instead of leaving the client hung.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.