Skip to content

Session timed out due to inactivity - #22171

Draft
amolpati30 wants to merge 1 commit into
SatelliteQE:masterfrom
amolpati30:remove_requiretty_configuration
Draft

Session timed out due to inactivity#22171
amolpati30 wants to merge 1 commit into
SatelliteQE:masterfrom
amolpati30:remove_requiretty_configuration

Conversation

@amolpati30

@amolpati30 amolpati30 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Root Cause: -

Selenium session timeout due to long wait_for loop. Here's the sequence:

  1. Opens a UI session (Selenium browser)
  2. Creates a host via the UI (works fine)
  3. Waits up to 1500 seconds (25 minutes) for the host's build_status_label to change from 'Pending installation', polling every 10 seconds via the API (not the browser)
  4. During this 25-minute wait, the Selenium browser sits idle
  5. Selenium Grid's inactivity timeout (default ~300-1800 seconds) kills the session
  6. When the wait_for times out (or completes) and the with ui_session() context manager tries to close the browser, it gets InvalidSessionIdException because the session was already removed

The Problem: -

The wait_for uses the API (sat.api.Host().search(...)) to poll, not the browser. So the Selenium session gets no activity for the entire polling duration and Selenium Grid terminates it for inactivity.

Solution: -

To avoid this issue, I am adding a search action through the session. This will keep the session active and prevent it from timing out or failing.

@amolpati30
amolpati30 requested a review from a team as a code owner July 20, 2026 17:03
@amolpati30 amolpati30 added No-CherryPick PR doesnt need CherryPick to previous branches Stream Introduced in or relating directly to Satellite Stream/Master labels Jul 20, 2026
@sourcery-ai

sourcery-ai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the REX provisioning template test to stop asserting on the deprecated requiretty sudoers line and only validate the remaining NOPASSWD configuration.

File-Level Changes

Change Details Files
Update REX provisioning template test expectation to match removal of the requiretty sudoers directive from the rendered template.
  • Change the combined sudoers assertion to only check for the NOPASSWD line in the generated snippet
  • Remove the expectation that a Defaults:<user> !requiretty line is present in the sudoers fragment for the REX user
tests/foreman/api/test_provisioningtemplate.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider asserting that the old Defaults:... !requiretty line is not present in rex_snippet to guard against reintroducing the deprecated setting in future template changes.
  • The combined sudoers assertion remains a bit brittle; you could split it into separate checks or use a regex to focus on the NOPASSWD semantics rather than the exact formatting of the echoed command.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider asserting that the old `Defaults:... !requiretty` line is *not* present in `rex_snippet` to guard against reintroducing the deprecated setting in future template changes.
- The combined sudoers assertion remains a bit brittle; you could split it into separate checks or use a regex to focus on the NOPASSWD semantics rather than the exact formatting of the echoed command.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread tests/foreman/api/test_provisioningtemplate.py
@amolpati30
amolpati30 marked this pull request as draft July 20, 2026 17:58
@amolpati30
amolpati30 force-pushed the remove_requiretty_configuration branch from 7ebb319 to bd964c9 Compare July 22, 2026 11:43
@amolpati30 amolpati30 added AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing 6.19.z CherryPick PR needs CherryPick to previous branches and removed No-CherryPick PR doesnt need CherryPick to previous branches labels Jul 22, 2026
@amolpati30 amolpati30 changed the title Remove the requiretty assertion since it is no longer used. Session timed out due to inactivity Jul 22, 2026
@Satellite-QE

Copy link
Copy Markdown
Collaborator

PRT Result

Build Number: 16198
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_computeresource_ocpv.py -k test_positive_userdata_image_provision_end_to_end --external-logging --include-onprem-provisioning
Test Result : =========== 1 failed, 1 deselected, 5 warnings in 1592.99s (0:26:32) ===========

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Jul 22, 2026
@amolpati30

Copy link
Copy Markdown
Contributor Author
trigger: test-robottelo
pytest: tests/foreman/ui/test_computeresource_ocpv.py -k test_positive_userdata_image_provision_end_to_end
provisioning: true

@Satellite-QE

Copy link
Copy Markdown
Collaborator

PRT Result

Build Number: 16294
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_computeresource_ocpv.py -k test_positive_userdata_image_provision_end_to_end --external-logging --include-onprem-provisioning
Test Result : =========== 1 failed, 1 deselected, 5 warnings in 1531.18s (0:25:31) ===========

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.19.z AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing CherryPick PR needs CherryPick to previous branches PRT-Failed Indicates that latest PRT run is failed for the PR Stream Introduced in or relating directly to Satellite Stream/Master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants