Skip to content

Fix http throwable responses #2251

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

Merged
merged 3 commits into from
Mar 10, 2021
Merged

Fix http throwable responses #2251

merged 3 commits into from
Mar 10, 2021

Conversation

doxiao
Copy link
Member

@doxiao doxiao commented Mar 9, 2021

The PR contains a fix for a problem in http error handling that is discovered during testing domain secure mode enabled without configuring SSL use case, plus some code cleanup based on warnings in IntelliJ.

Problem: when a HttpAsyncRequestStep's AsyncProcessing is resumed without a response object, it was always considered as a timeout although sometimes resume is called with an Exception that should be made visible to the user. One example of such exceptions is javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.

With the fix, operator logs a warning message and fails the corresponding step.

(Note: the changes originally contained a fix for a NPE on unboxing the chosen port number for Prometheus. The code change for this has been removed after merging with the develop branch yesterday; apparently the problematic code has been changed by a PR that is merged yesterday.)

Integration test result in Jenkins before the last merge with develop: https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/4250/.
Integration test run with the latest: https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/4255/.
Jenkins job with review changes: https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/4256/.

@doxiao doxiao changed the title Fix http throwable reponses Fix http throwable responses Mar 9, 2021
Copy link
Member

@russgold russgold left a comment

Choose a reason for hiding this comment

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

Thank you for locking down the access of various methods; that will make further maintenance simpler, as we don't have to search as much for who is calling each one.

I have a few code quality comments that I think should be fixed before this is merged, but otherwise it looks good.

@@ -108,7 +108,11 @@ private void checkTimeout(AsyncFiber fiber) {

private void resume(AsyncFiber fiber, HttpResponse<String> response, Throwable throwable) {
if (throwable != null) {
Copy link
Member

Choose a reason for hiding this comment

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

This method now has two different tests for response being null - one in the block with throwable != null and one in the Optional.ofNullable(response) logic.

It would probably be better to merge them or otherwise simplify the logic. There are two different things being tested for null, here: throwable and response. Are all four combinations meaningful?

Copy link
Member Author

@doxiao doxiao Mar 9, 2021

Choose a reason for hiding this comment

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

This method now has two different tests for response being null - one in the block with throwable != null and one in the Optional.ofNullable(response) logic.

It would probably be better to merge them or otherwise simplify the logic. There are two different things being tested for null, here: throwable and response. Are all four combinations meaningful?

The only permutation that is not meaningful is both null. Let me try to refactor this method a little.

completeWithThrowableBeforeTimeout(nextAction, new Throwable("Test"));

assertThat(logRecords, containsWarning(HTTP_REQUEST_GOT_THROWABLE));
m.revert();
Copy link
Member

Choose a reason for hiding this comment

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

All mementos should be reverted in the tearDown method; among other things, that ensures that if the test exceptions out, the revert still happens, so other tests are not affected. It appears that you want to collect an additional log messages. The simplest thing would be simply to add it to the original least created during the setUp call. If for some reason you cannot do that, take advantage of the fact that the memento itself is saved as consoleMemento and just call its collectLogMessages method, here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I started with adding this new memento to the list in setUp method, but it did not work. Let me try consoleMemento suggestion.

@doxiao doxiao requested a review from russgold March 9, 2021 22:36
@rjeberhard rjeberhard merged commit bb00f8c into develop Mar 10, 2021
@rjeberhard rjeberhard deleted the fix-http-throwable branch January 31, 2022 14:10
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.

3 participants