Skip to content
This repository was archived by the owner on Dec 31, 2025. It is now read-only.
This repository was archived by the owner on Dec 31, 2025. It is now read-only.

stan StreamingConnection.publish() hangs forever in some cases #79

Description

@tul

We've hit a problem a couple of times recently where our servers have become permanently blocked when trying to publish to STAN.

Specifically, publishes are hanging when trying to put in the BlockingQueue which is utilised to control the number of outstanding acks:

StreamingConnectionImpl.java:348

       // Use the buffered channel to control the number of outstanding acks.
        try {
            pac.put(PubAck.getDefaultInstance());  // <<--- hang
        } catch (InterruptedException e) {
            // TODO:  Reevaluate this.
            // Eat this because you can't really do anything with it
        }

If we tear down the STAN connection by completely disconnecting and reconnecting from the server, these threads still remain blocked in the publish on the now closed connection.

I'm thinking perhaps this put() should be an offer() with a timeout, allowing publishes to optionally fail back to the caller (via a thrown exception) if too many are in flight.

Alternatively, or perhaps also, when a streaming connection is torn down, perhaps it should empty the BlockingQueue so that any publishes hanging on the put/offer would at least progress.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions