Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Rare vika.exceptions.ServerError when using page.wait_for_timeout() (occurs sporadically) #2967

@DepravityDemo

Description

@DepravityDemo

Version

Version 1.55.0

Steps to reproduce

Describe the bug
When using page.wait_for_timeout(), the call fails with a vika.exceptions.ServerError (500), even though no explicit Vika API calls are made in the code at that moment.

Vika is only used in event handlers for:

  • self.page.on("console", self.handle_console)
  • self.page.on('response', self.handle_response)
  • self.page.on("pageerror", self.handle_page_error)

To Reproduce
Steps to reproduce the behavior:

  1. Set up Playwright page with Vika event handlers
  2. Call page.wait_for_timeout()
  3. Observe the unexpected Vika server error

Error Frequency

  • The issue occurs sporadically (~1% of cases based on our observations)
  • Most wait_for_timeout() calls complete successfully
  • No clear pattern to the failures

Manual System Check Results:

  • No high CPU usage (via top observation)
  • Adequate free memory (visible in free -h)
  • Disk space sufficient (confirmed by df -h)
  • No abnormal process activity

Error Traceback
Traceback (most recent call last):
File "/home/webui/webui-new/baidu/bpitqa/be-webui/webui/visualization/case/ExecuteCase.py", line 101, in test_case
exec(result, globals(), locals())
File "", line 26, in
File "/home/webui/webui-new/baidu/bpitqa/be-webui/webui/common/PlayPage.py", line 1372, in sleep
self.page.wait_for_timeout(sleep_time * 1000)
File "/home/webui/miniconda3/envs/py3.11.8/lib/python3.11/site-packages/playwright/sync_api/_generated.py", line 11496, in wait_for_timeout
self._sync(self._impl_obj.wait_for_timeout(timeout=timeout))
File "/home/webui/miniconda3/envs/py3.11.8/lib/python3.11/site-packages/playwright/_impl/_sync_base.py", line 115, in _sync
return task.result()
^^^^^^^^^^^^^
File "/home/webui/miniconda3/envs/py3.11.8/lib/python3.11/site-packages/playwright/_impl/_page.py", line 1104, in wait_for_timeout
await self._main_frame.wait_for_timeout(timeout)
File "/home/webui/miniconda3/envs/py3.11.8/lib/python3.11/site-packages/playwright/_impl/_frame.py", line 844, in wait_for_timeout
await self._channel.send("waitForTimeout", None, {"waitTimeout": timeout})
File "/home/webui/miniconda3/envs/py3.11.8/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 69, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/webui/miniconda3/envs/py3.11.8/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 558, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
vika.exceptions.ServerError: Page.wait_for_timeout: API Server Error: 500

Expected behavior

page.wait_for_timeout()` should work normally without raising Vika-related exceptions, as it's a local timing operation.

Actual behavior

Getting vika.exceptions.ServerError: Page.wait_for_timeout: API Server Error: 500

Additional context

No response

Environment

- Operating System: [Ubuntu 22.04]
- CPU: [amd64]
- Browser: [Chromium]
- Python Version: [3.11.8]
- Playwright version: 1.55
- Vika version:  1.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions