Commit 01e198a
ZOOKEEPER-3633: AdminServer commands throw NPE when only secure client port is used
When only secureClientPort is defined in the config and there is no regular clientPort,
then both the stat and the conf commands on the AdminServer result in 500 Server Error caused by
NullPointerExceptions. The problem is that no serverCnxFactory is defined in the
ZooKeeperServer in this case, we have only secureServerCnxnFactory.
In the fix we return info about both the secure and unsecure connections.
Example of the stat command output for secure-only configuration:
```
{
"version" : "3.6.0-SNAPSHOT-8e8905069f4bff670c0492fe9e28ced0f86bca00, built on 11/29/2019 08:04 GMT",
"read_only" : false,
"server_stats" : {
"packets_sent" : 1,
"packets_received" : 1,
"fsync_threshold_exceed_count" : 0,
"client_response_stats" : {
"last_buffer_size" : -1,
"min_buffer_size" : -1,
"max_buffer_size" : -1
},
"data_dir_size" : 671094270,
"log_dir_size" : 671094270,
"last_processed_zxid" : 20,
"outstanding_requests" : 0,
"server_state" : "standalone",
"avg_latency" : 5.0,
"max_latency" : 5,
"min_latency" : 5,
"num_alive_client_connections" : 1,
"provider_null" : false,
"uptime" : 15020
},
"client_response" : {
"last_buffer_size" : -1,
"min_buffer_size" : -1,
"max_buffer_size" : -1
},
"node_count" : 6,
"connections" : [ ],
"secure_connections" : [ {
"remote_socket_address" : "127.0.0.1:57276",
"interest_ops" : 1,
"outstanding_requests" : 0,
"packets_received" : 1,
"packets_sent" : 1
} ],
"command" : "stats",
"error" : null
}
```
Author: Mate Szalay-Beko <[email protected]>
Reviewers: Andor Molnar <[email protected]>, Enrico Olivelli <[email protected]>, Norbert Kalmar <[email protected]>
Closes #1161 from symat/ZOOKEEPER-36331 parent 815c8f2 commit 01e198a
3 files changed
Lines changed: 49 additions & 3 deletions
File tree
- zookeeper-server/src
- main/java/org/apache/zookeeper/server
- admin
- test/java/org/apache/zookeeper/server/admin
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
417 | | - | |
| 417 | + | |
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| |||
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
577 | 577 | | |
578 | 578 | | |
579 | 579 | | |
580 | | - | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
581 | 596 | | |
582 | 597 | | |
583 | 598 | | |
| |||
Lines changed: 32 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
222 | | - | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
223 | 231 | | |
224 | 232 | | |
225 | 233 | | |
| |||
264 | 272 | | |
265 | 273 | | |
266 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
267 | 298 | | |
0 commit comments