You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "codelipenghui (via GitHub)" <gi...@apache.org> on 2026/10/20 14:21:24 UTC

[PR] [fix][broker] Fix the broker's WebSocket service ignoring configurationStoreConfigPath [pulsar]

codelipenghui opened a new pull request, #27015:
URL: https://github.com/apache/pulsar/pull/27015

   ### Motivation
   
   When `webSocketServiceEnabled=true`, the broker creates a `WebSocketService`, and `WebSocketService.start()` opens a configuration metadata store client of its own through `PulsarResources.createConfigMetadataStore(...)`. That client is created without a configuration file, so it ignores `configurationStoreConfigPath`, and `metadataStoreConfigPath` that it falls back to, unlike the broker's own client in `PulsarService.createConfigurationMetadataStore` (PIP-366).
   
   When the configuration store needs the settings in that file to be reached, for example the ZooKeeper client's TLS settings (`zookeeper.client.secure`, `zookeeper.clientCnxnSocket`, the trust store), the WebSocket service's client can't connect, and the broker fails to start after the session timeout:
   
   ```
   ERROR org.apache.pulsar.broker.PulsarService - Failed to start Pulsar service
   org.apache.pulsar.broker.PulsarServerException: org.apache.pulsar.metadata.api.MetadataStoreException: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
   	at org.apache.pulsar.websocket.WebSocketService.start(WebSocketService.java:107)
   	at org.apache.pulsar.broker.PulsarService.addWebSocketServiceHandler(PulsarService.java:1369)
   ```
   
   The WebSocket service opens that client even when the configuration store isn't separate from the local metadata store, and even when authorization is disabled, so any broker with the WebSocket service enabled and such a configuration file is affected.
   
   ### Modifications
   
   - `WebSocketService`: add a constructor that takes the `PulsarResources` to use. With them, `start()` doesn't open a configuration metadata store client, and `close()` leaves the shared resources to their owner. The existing constructors pass `null`, so the standalone WebSocket proxy and the WebSocket service in the proxy keep opening their own client.
   - `PulsarService`: pass the broker's `PulsarResources` to the WebSocket service, so that it uses the broker's configuration store client with all of its settings. The broker no longer opens a second session with the configuration store either.
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change added tests and can be verified as follows:
   
   - `PulsarServiceTest.testWebSocketServiceSharesBrokerConfigurationStore` starts a broker with the WebSocket service enabled, whose configuration store only the broker's own client reaches. Without the fix, it fails with the `ConnectionLoss` above.
   - The integration test `WebSocketTlsConfigurationStoreTest`, added to `pulsar-websocket.xml`, runs the configuration store with a TLS-only port for the broker and puts the ZooKeeper client's TLS settings only in the file of `configurationStoreConfigPath`. It produces and consumes through the broker's WebSocket endpoint. Without the fix, the broker doesn't start. With it, the broker has a single TLS session with the configuration store, and the test passes.
   
     The test certificate is for `localhost`, so the test turns off the hostname verification of the broker's ZooKeeper client. With Netty 4.2, that takes `-Dio.netty.handler.ssl.defaultEndpointVerificationAlgorithm=NONE` as well as `zookeeper.ssl.hostnameVerification=false`: Netty 4.2 clients verify the hostname by default, and ZooKeeper only turns the verification on, never off.
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] The metrics
   - [ ] Anything that affects deployment
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [fix][broker] Fix the broker's WebSocket service ignoring configurationStoreConfigPath [pulsar]

Posted by "codelipenghui (via GitHub)" <gi...@apache.org>.
codelipenghui merged PR #27015:
URL: https://github.com/apache/pulsar/pull/27015


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org