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

QACI-406 Websockets tck failure fix: Grizzly #24

Merged

Conversation

dmatej
Copy link

@dmatej dmatej commented Sep 7, 2020

- default is none
- profile npn uses grizzly-npn-bootstrap
- profile openjsse uses openjsse
- versions can be overriden from command line (to compare results)
- important loggers are explicitly named in logging.properties
- moving this interface out is a breaking change
- can run with any compatible implementation, not only NPN Bootstrap
- with new JDK versions after 8u250 uses it's JSSE impl by default
- still can use older NPN bootstrap versions if configured
- can use also other implementations (openjsse)
@dmatej dmatej self-assigned this Sep 7, 2020
@@ -253,14 +253,14 @@ protected NextAction executeFilter(final FilterExecutor executor,
NextAction nextNextAction;
do {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINE, "Execute filter. filter={0} context={1}",
LOGGER.log(Level.FINE, "before filter execution. filter={0} context={1}",
Copy link
Author

Choose a reason for hiding this comment

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

Symmetric logging is easier to find/grep and to understand

@@ -171,7 +171,7 @@
<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-npn-api</artifactId>
<version>${grizzly.alpn.version}</version>
<version>${grizzly.npn.api.version}</version>
Copy link
Author

Choose a reason for hiding this comment

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

At the start I wasn't sure which property is for which dependency.

@@ -1,12 +0,0 @@
package org.glassfish.grizzly.ssl;
Copy link
Author

@dmatej dmatej Sep 7, 2020

Choose a reason for hiding this comment

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

Cause of the TCK failure. Tyrus depends on this interface, so it must not be moved outside the SSLBaseFilter class. Breaking change.

@@ -1208,4 +1202,15 @@ public Buffer clone(final Connection connection,
return originalMessage;
}
}

Copy link
Author

Choose a reason for hiding this comment

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

Moved back.

@@ -36,7 +36,7 @@
* @return <tt>true</tt> if passed {@link HttpContent} is a <tt>HttpTrailder</tt>.
*/
public static boolean isTrailer(HttpContent httpContent) {
return HttpTrailer.class.isAssignableFrom(httpContent.getClass());
return httpContent != null && HttpTrailer.class.isAssignableFrom(httpContent.getClass());
Copy link
Author

Choose a reason for hiding this comment

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

More robust. Possible NPE fixed.

</dependencies>

<profiles>
Copy link
Author

@dmatej dmatej Sep 7, 2020

Choose a reason for hiding this comment

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

Possible to use alternatives, but default is JDK version, not npn.
It is not even a breaking change, because the bootstrap was created to fill the gap for JDK8 versions without ALPN support and it is an old copy of Sun jsse classes, which were enhanced and backported back to JDK8 from JDK9/11.

private static final Method nativeHandshakeMethod;

static {
boolean isExtensionFound = false;
Copy link
Author

Choose a reason for hiding this comment

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

When I started to test combinations of JDK vs. grizzly vs. npn-bootstrap vs. npn-api, AlpnSupport sometimes threw exceptions on unexpected places. See Confluence page for few details.
Finally, I created a new class for all this heuristic and tested it against all JDK8 versions I have (both AdoptJDK and Zulu 8u265 are the newest)

@@ -25,7 +25,6 @@
import java.util.List;
Copy link
Author

Choose a reason for hiding this comment

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

Grizzly's tests were failing because of this class. I was able to fix one of two failing tests, but then I noticed that the lock usages are not always correct and is hard to find all paths. So I did around 100 small iterations to make the code more readable and to fix both tests.

* @author Alexey Stashok
*/
public abstract class AbstractHttp2Test {
static {
Copy link
Author

Choose a reason for hiding this comment

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

Logging in tests, so you can see order of method executions in multithreaded tests.

pom.xml Outdated Show resolved Hide resolved
@dmatej dmatej marked this pull request as ready for review September 7, 2020 16:49
@dmatej dmatej requested a review from MattGill98 September 7, 2020 16:49
@dmatej dmatej changed the title QACI-406 Websockets tck failure fix QACI-406 Websockets tck failure fix: NPN Sep 7, 2020
@dmatej dmatej changed the title QACI-406 Websockets tck failure fix: NPN QACI-406 Websockets tck failure fix: Grizzly Sep 7, 2020
@dmatej dmatej requested a review from MeroRai September 7, 2020 16:52
Copy link

@MattGill98 MattGill98 left a comment

Choose a reason for hiding this comment

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

Have you tested for regressions against PAYARA-3031?

@dmatej
Copy link
Author

dmatej commented Sep 10, 2020

Have you tested for regressions against PAYARA-3031?

Nope, but I will add the reproducer to Payara Samples now. I have seen your 2 years old fix now, now I'm curious if it still works or not. But those locks before both our changes were used incorrectly.

- in this state grizzly:
  - still fails TrailersTest (grizzly-http2)
  - passes TCK tests (websocket) (THIS CHANGED!)
  - fails h2spec (race condition)
  - fails LargeResponseTest (Payara Samples - http2, race condition)
- see lines with FIXME: this causes data corruption!
- fixed ALPN support
- fixed two failing tests (trailers)
- better compatibility and logging
@dmatej dmatej force-pushed the QACI-406-websockets-tck-failure-fix branch from 566f2e8 to bb55a72 Compare September 22, 2020 15:10
SNAPSHOT version missed in version update commit
@MattGill98
Copy link

I've pushed a minor update to the bom version - worth remembering in future that the mvn versions:set command needs running in the top level folder as well as the BOM folder

Copy link

@MattGill98 MattGill98 left a comment

Choose a reason for hiding this comment

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

Looks like a good change - make sure to push upstream when you get a chance

@MattGill98 MattGill98 merged commit 8a9d506 into 2.4.4.payara-maintenance Sep 23, 2020
@dmatej dmatej deleted the QACI-406-websockets-tck-failure-fix branch November 19, 2020 07:45
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.

2 participants