Repository navigation
Open
Description
CometD version(s) 8.0.7
Java version & vendor (use: java -version) JDK 17
Description
when a bayeuxClient.disconnect is issued, server is not responding with disconnected message.
How to reproduce?
call bayeuxClient.disconnect()
OR
call bayeuxclient.disconnect(Long.valueOf(10000)
Debug logs below -
2025-05-02 16:17:52.205 [DEBUG] [HttpClient@cb1c58c-34] [ ] Received messages [{ext={replay=true, payload.format=true}, minimumVersion=1.0, clientId=day1sc0vfn63hbuc905br2117l5f, supportedConnectionTypes=[long-polling], channel=/meta/handshake, id=1, version=1.0, successful=true}]
2025-05-02 16:17:52.207 [DEBUG] [HttpClient@cb1c58c-34] [ ] Processing {ext={replay=true, payload.format=true}, minimumVersion=1.0, clientId=day1sc0vfn63hbuc905br2117l5f, supportedConnectionTypes=[long-polling], channel=/meta/handshake, id=1, version=1.0, successful=true}
2025-05-02 16:17:52.210 [DEBUG] [HttpClient@cb1c58c-34] [ ] State updated: HANDSHAKING -> HANDSHAKEN
2025-05-02 16:17:52.216 [DEBUG] [HttpClient@cb1c58c-34] [ ] Sending messages [{ext={replay={/topic/cFields=46}}, clientId=day1sc0vfn63hbuc905br2117l5f, channel=/meta/subscribe, id=4, subscription=/topic/cFields}]
2025-05-02 16:17:52.218 [DEBUG] [HttpClient@cb1c58c-34] [ ] Started waiting for message replies, 30000 ms, task@d8d4d18
2025-05-02 16:17:52.220 [DEBUG] [HttpClient@cb1c58c-34] [ ] Sent message {ext={replay={/topic/cFields=46}}, clientId=day1sc0vfn63hbuc905br2117l5f, channel=/meta/subscribe, id=4, subscription=/topic/cFields}
2025-05-02 16:17:52.222 [DEBUG] [HttpClient@cb1c58c-34] [ ] State updated: HANDSHAKEN -> CONNECTING
2025-05-02 16:17:52.224 [DEBUG] [HttpClient@cb1c58c-34] [ ] Scheduled connect in 0+0 ms
2025-05-02 16:17:52.225 [DEBUG] [pool-2-thread-1] [ ] Connecting, transport cuConsumer$1@14c18a6a
2025-05-02 16:17:52.225 [DEBUG] [pool-2-thread-1] [ ] Sending messages [{clientId=day1sc0vfn63hbuc905br2117l5f, advice={timeout=0}, channel=/meta/connect, id=5, connectionType=long-polling}]
2025-05-02 16:17:52.225 [DEBUG] [pool-2-thread-1] [ ] Sending /meta/connect {clientId=day1sc0vfn63hbuc905br2117l5f, advice={timeout=0}, channel=/meta/connect, id=5, connectionType=long-polling}
2025-05-02 16:17:52.226 [DEBUG] [pool-2-thread-1] [ ] Started waiting for message replies, 30000 ms, task@41858029
2025-05-02 16:17:52.226 [DEBUG] [pool-2-thread-1] [ ] Sent connect {clientId=day1sc0vfn63hbuc905br2117l5f, advice={timeout=0}, channel=/meta/connect, id=5, connectionType=long-polling}
2025-05-02 16:17:52.227 [DEBUG] [pool-3-thread-1] [ ] Sending messages [{clientId=e5p1i3jbj6iex99t63q7s33lq58y, advice={timeout=0}, channel=/meta/connect, id=6, connectionType=long-polling}]
2025-05-02 16:17:52.228 [DEBUG] [pool-3-thread-1] [ ] Sending /meta/connect {clientId=e5p1i3jbj6iex99t63q7s33lq58y, advice={timeout=0}, channel=/meta/connect, id=6, connectionType=long-polling}
2025-05-02 16:17:52.228 [DEBUG] [pool-3-thread-1] [ ] Started waiting for message replies, 30000 ms, task@760d7e9e
2025-05-02 16:17:52.228 [DEBUG] [pool-3-thread-1] [ ] Sent connect {clientId=e5p1i3jbj6iex99t63q7s33lq58y, advice={timeout=0}, channel=/meta/connect, id=6, connectionType=long-polling}
2025-05-02 16:17:52.229 [DEBUG] [HttpClient@cb1c58c-34] [ ] Notifying threads in waitFor()
2025-05-02 16:17:52.313 [DEBUG] [HttpClient@cb1c58c-37] [ ] Stored cookie Immutable@4069d9f1[BrowserId=_1zWuydwEfCk9DdyDf9-IA; domain=.salesforce.com; Expires=Sat, 2 May 2026 16:17:52 GMT; Max-Age=31536000; path=/; SameSite=None; Secure=true]
2025-05-02 16:17:52.321 [DEBUG] [HttpClient@cb1c58c-37] [ ] Cancelled waiting for message replies, task@d8d4d18
2025-05-02 16:17:52.321 [DEBUG] [HttpClient@cb1c58c-37] [ ] Received messages [{clientId=day1sc0vfn63hbuc905br2117l5f, channel=/meta/subscribe, id=4, subscription=/topic/cFields, error=400::The replayId {46} you provided was invalid. Please provide a valid ID, -2 to replay all events, or -1 to replay only new events., successful=false}]
2025-05-02 16:17:52.321 [DEBUG] [HttpClient@cb1c58c-37] [ ] Processing {clientId=day1sc0vfn63hbuc905br2117l5f, channel=/meta/subscribe, id=4, subscription=/topic/cFields, error=400::The replayId {46} you provided was invalid. Please provide a valid ID, -2 to replay all events, or -1 to replay only new events., successful=false}
2025-05-02 16:17:52.322 [INFO ] [HttpClient@cb1c58c-37] [ ] cuConsumer: Not subscribed to : /topic/cFields
2025-05-02 16:17:52.323 [INFO ] [HttpClient@cb1c58c-37] [ ] cuConsumer: Got Error ... {clientId=day1sc0vfn63hbuc905br2117l5f, channel=/meta/subscribe, id=4, subscription=/topic/cFields, error=400::The replayId {46} you provided was invalid. Please provide a valid ID, -2 to replay all events, or -1 to replay only new events., successful=false}
2025-05-02 16:17:52.323 [INFO ] [HttpClient@cb1c58c-37] [ ] cuConsumer: Disconnecting cuClient ...
We should get a
channel=/meta/disconnect successful=true <------- at this place or atleast after the wait of 5 seconds
2025-05-02 16:17:52.323 [INFO ] [HttpClient@cb1c58c-37] [ ] cuConsumer: Sleeping for 5 seconds before reconnect.
Metadata
Metadata
Assignees
Labels
No labels
Activity
sbordet commentedon May 2, 2025
What exact vendor/version are the server and the client?
The logs are incomplete, or do not show the client attempting to send a
/meta/disconnectto the server.Can you show what your code does when it receives a subscription failure?
aakashpanjwani commentedon May 2, 2025
Thank you for quick reply @sbordet
Whenever the consumer gets a 400/401/403 error... it will attempt to disconnect the client with below code.
aakashpanjwani commentedon May 2, 2025
Scenario is -
during app startup - I'm using the max replay id to subscribe to the topic - now this max replay id is out of the retention window hence I'm getting a error as below :
2025-05-02 15:57:30.673 [INFO ] [HttpClient@9499643-39] [ ] Got Error ... {clientId=d5q19x6kfx8ie20pudv1hnkcr67v, channel=/meta/subscribe, id=219, subscription=/topic/cuFields, error=400::The replayId {46} you provided was invalid. Please provide a valid ID, -2 to replay all events, or -1 to replay only new events., successful=false}
now when I get this error, I catch it using a Listener and then initiate a disconnect.
this disconnect is not responded by the server.
sbordet commentedon May 2, 2025
The code you posted above does would not log the line:
Are you sure that's the code you're running?
BayeuxClient.isConnected()only returnstrueif a/meta/connecthas been sent, so I would not use that, but rather: