Skip to content

AK-DCON-763: Added logging for investigation #176

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Akshay-kumar-saxena
Copy link
Contributor

No description provided.

@Copilot Copilot AI review requested due to automatic review settings August 8, 2025 05:18
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds temporary debugging logging to investigate connection issues in the retryable HTTP client. The changes introduce logging statements to track retry attempts and handle connection errors by recreating sessions when ClientError exceptions occur.

Key changes:

  • Added debug logging to track retry counts and exception handling
  • Implemented session recreation logic for ClientError exceptions to establish fresh connections
  • Added detailed logging for different types of network exceptions

Comment on lines 299 to 305
logging.warning(f"Connection reset/error detected: {e}. Attempt {retry_attempts+1}/{self.retries}")
# Close existing session and create fresh one for new connection
if self.session:
await self.session.close()
self.session = self.fn_get_session()
else:
logging.info(f"[TEST - 763] - Network error detected: {e}. Attempt {retry_attempts+1}/{self.retries}")
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

The retry attempt count is incorrect. At this point, retry_attempts represents the current attempt (1-based), so retry_attempts+1 would show attempt 2/3 when actually on attempt 1/3. Use retry_attempts instead of retry_attempts+1.

Suggested change
logging.warning(f"Connection reset/error detected: {e}. Attempt {retry_attempts+1}/{self.retries}")
# Close existing session and create fresh one for new connection
if self.session:
await self.session.close()
self.session = self.fn_get_session()
else:
logging.info(f"[TEST - 763] - Network error detected: {e}. Attempt {retry_attempts+1}/{self.retries}")
logging.warning(f"Connection reset/error detected: {e}. Attempt {retry_attempts}/{self.retries}")
# Close existing session and create fresh one for new connection
if self.session:
await self.session.close()
self.session = self.fn_get_session()
else:
logging.info(f"[TEST - 763] - Network error detected: {e}. Attempt {retry_attempts}/{self.retries}")

Copilot uses AI. Check for mistakes.

Comment on lines 299 to 305
logging.warning(f"Connection reset/error detected: {e}. Attempt {retry_attempts+1}/{self.retries}")
# Close existing session and create fresh one for new connection
if self.session:
await self.session.close()
self.session = self.fn_get_session()
else:
logging.info(f"[TEST - 763] - Network error detected: {e}. Attempt {retry_attempts+1}/{self.retries}")
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

The retry attempt count is incorrect. At this point, retry_attempts represents the current attempt (1-based), so retry_attempts+1 would show attempt 2/3 when actually on attempt 1/3. Use retry_attempts instead of retry_attempts+1.

Suggested change
logging.warning(f"Connection reset/error detected: {e}. Attempt {retry_attempts+1}/{self.retries}")
# Close existing session and create fresh one for new connection
if self.session:
await self.session.close()
self.session = self.fn_get_session()
else:
logging.info(f"[TEST - 763] - Network error detected: {e}. Attempt {retry_attempts+1}/{self.retries}")
logging.warning(f"Connection reset/error detected: {e}. Attempt {retry_attempts}/{self.retries}")
# Close existing session and create fresh one for new connection
if self.session:
await self.session.close()
self.session = self.fn_get_session()
else:
logging.info(f"[TEST - 763] - Network error detected: {e}. Attempt {retry_attempts}/{self.retries}")

Copilot uses AI. Check for mistakes.

# Close existing session and create fresh one for new connection
if self.session:
await self.session.close()
self.session = self.fn_get_session()
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

Creating a new session without awaiting the close operation could lead to resource leaks. The session.close() call should be awaited before creating a new session to ensure proper cleanup.

Suggested change
self.session = self.fn_get_session()
self.session = await self.fn_get_session()

Copilot uses AI. Check for mistakes.

Copy link

github-actions bot commented Aug 8, 2025

Qodana Community for Python

1 new problem were found

Inspection name Severity Problems
Unsatisfied package requirements ◽️ Notice 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2024.2.5
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant