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

fix: [#4452][#4456][#4460][botframework-streaming] Should reject pending requests on disconnection #4461

Merged
merged 8 commits into from
Apr 24, 2023

Conversation

compulim
Copy link
Contributor

@compulim compulim commented Apr 22, 2023

Fixes #4452. Fixes #4456. Fixes #4460.

APPROVERS: This fix may need to port to C#. Please check C# source code and port accordingly.

Description

When Web Socket disconnected, all pending requests should be rejected.

Specific Changes

  • Added RequestManager.rejectAllResponses() to reject all pending responses
  • Updated browserWebSocketClient and nodeWebSocketClient to call RequestManager.rejectAllResponses() on disconnection
  • Fixed inconclusive tests related to .to.throw
  • Fixed a racing condition in ProtocolAdapter
    • If server respond quickly, some responses may be dropped
    • This is because their respective requests are registered in RequestManager only after the request is send, the response may already get through

Testing

Added tests to make sure NodeWebSocketClient and WebSocketServer can communicate with each other by using real Web Socket. This should make our test more stable.

Note: because there is no infrastructure for testing BrowserWebSocketClient, there are no tests added for it.

Additional context

This fix is related to an issue in botframework-directlinejs. When postActivity() is called after disconnection, it is not failing.

botframework-directlinejs did not fail the call because botframework-streaming does not reject any pending requests.

@compulim compulim requested a review from a team as a code owner April 22, 2023 01:14
@compulim
Copy link
Contributor Author

All required checks are completed. Some optional checks are failing because:

  • tests.yml / tests.yml ubuntu (node 16.x) (pull_request)
    • Named pipe doesn't work under Ubuntu
  • E2E-BF-Streaming-DL-ASE-Test
    • It seems the pipeline is down since 2023 March 23

@tracyboehrer tracyboehrer added the Automation: Parity with dotnet The PR needs to be ported to dotnet. label Apr 24, 2023
@coveralls
Copy link

coveralls commented Apr 24, 2023

Pull Request Test Coverage Report for Build 4792076511

  • 8 of 8 (100.0%) changed or added relevant lines in 4 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.07%) to 84.729%

Files with Coverage Reduction New Missed Lines %
libraries/botframework-streaming/src/namedPipe/namedPipeClient.ts 1 84.09%
libraries/botframework-streaming/src/namedPipe/namedPipeServer.ts 1 78.08%
Totals Coverage Status
Change from base Build 4198805038: 0.07%
Covered Lines: 20035
Relevant Lines: 22409

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Automation: Parity with dotnet The PR needs to be ported to dotnet.
Projects
None yet
3 participants