Skip to content
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

Acqp-323 prevent blank connection errors in STOMP connections #803

Merged
merged 5 commits into from
Jan 28, 2025

Conversation

keithralphs
Copy link
Contributor

@keithralphs keithralphs commented Jan 27, 2025

Add handler functions to check for Exceptions with message that are None, Empty String or a String that consists only of spaces

Fixes #792

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.45%. Comparing base (07bd6ba) to head (262b642).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #803      +/-   ##
==========================================
+ Coverage   93.43%   93.45%   +0.01%     
==========================================
  Files          38       38              
  Lines        2103     2108       +5     
==========================================
+ Hits         1965     1970       +5     
  Misses        138      138              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@callumforrester callumforrester left a comment

Choose a reason for hiding this comment

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

Thanks Keith, at the risk of being annoying, please could you reference the Github issue rather than the internal issue? We check those every sprint anyway, so would be good if kept things automatically closing on Github.

Also, please could you make an issue to revisit the EnvironmentResponse API as discussed?

Comment on lines 103 to 105
error_message=_safe_message(
type(self).__name__, self._state.error_message
),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should: Since this just propagates the previous error message it will become WorkerDispatcher: <previous message>, where it was <previous message> before. That feels very inconsistent, the user should see the same message when the same thing breaks. Since this is always set by _safe_exception_message you're probably safe just propagating it without checking?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did wonder whether to do this one. If there is an error message then yes, it would be glueing WorkerDispatcher on the front, which might be inconsistent. It was added for the case where the message was blank, but I think I misread the code at the time, thinking it was an error with stop, which it isn't so should probably remove.

if status.error_message is not None:
if (
status.error_message is not None
and BLANK_REPORT not in status.error_message
Copy link
Contributor

Choose a reason for hiding this comment

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

Must: Not sure I understand the logic here, BLANK_REPORT being in the error message implies there's been an error without text (i.e. an unknown error), but we should still raise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is basically saying if there's an error message, but it's not the one that gets inserted when there's been an exception that didn't have its own message (i.e. it's and error message that actually tells you something) then raise the error. This is equivalent to the previous behaviour, the only difference being that, in that case, no standard message would have been inserted so it would just be None.

Copy link
Contributor

Choose a reason for hiding this comment

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

So from discussion, here is how we want the client to behave:

  initialized=True initialized=False
error_message is None Return Block until next poll
error_message is not None Undefined Raise

This is true regardless of whether BLANK_REPORT is present or not, because error_message not being None means an exception has been thrown, expanded table:

initialized=True initialized=False
error_message is None Return Block until next poll
error_message is not None and BLANK_REPORT in error_message Undefined Raise
error_message is not None and BLANK_REPORT not in error_message Undefined Raise

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Issue #806 created to cover implementation and use of this logic

Copy link
Contributor

@callumforrester callumforrester left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks

@keithralphs keithralphs merged commit e18b9be into main Jan 28, 2025
31 checks passed
@keithralphs keithralphs deleted the ACQP-323 branch January 28, 2025 14:50
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.

Stomp connection error hidden in environment response
2 participants