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

Occasional failure to connect when using multiple Subscribe + Execute invocations #217

Open
palcs opened this issue Apr 16, 2024 · 0 comments

Comments

@palcs
Copy link

palcs commented Apr 16, 2024

High-Level Problem

A .NET 8 service application that subscribes to messages from PubNub and, upon upgrade/restart, will occasionally get into a state where it cannot connect to PubNub until the application is restarted again.

Notes

  • The .NET application is .NET 8 (as time of this writing, v8.0.200).
  • Using NuGet PubnubPCL v6.19.7 (latest as of April 16, 2024).
  • Using ReconnectionPolicy repeatedly fails to connect to PubNub.
  • The current nature of the .NET application is to perform multiple Subscribe() + Execute() invocations when an entity from a separate system is "discovered" (e.g. Discover Entity A then perform Subscribe().Channels("entity-A-notification-type1").Execute()).
  • My personal gut feeling is a thread synchronization issue, possibly somewhere around ClientNetworkStatus.RefHttpClient = httpClientNetworkStatus.
  • When I add a project reference to PubnubApiPCL.csproj, I caught this state where, somehow, there is a header with a null key (.NET thread safety issue with HTTP headers?).
    Untitled

Reproduction

I have attached a simple application (from a Windows system). You will need to populate SubscribeKey, AuthKey, and channels with real values. Afterwards, you can run the script run.bat which should build and then re-start the application until the problem eventually reproduces; the output will indicate a failure to connect (ERROR Internet connection problem. Retrying connection Cat=PNNetworkIssuesCategory). I usually have it reproduce within about 30 seconds.
ReproductionApp.zip

The application is fairly straightforward: create the Pubnub instance, perform Subscribe().Channels(...).Execute() multiple times, then wait about 2 seconds for connection messages before exiting.

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

No branches or pull requests

1 participant