[MDEV-26277] Suspiciously high server status variable values Created: 2021-07-29  Updated: 2022-06-15

Status: Open
Project: MariaDB Server
Component/s: Server
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Louka Dlagnekov (Inactive) Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None


 Description   

We've discovered that a few server status variables, like Ssl_ctx_verify_depth, sometimes have values that are the maximum an unsigned 64-bit integer can hold, even when those counts are not expected to get very high.

For instance,

MariaDB [(none)]> show global status where Value > 1844674407370955;   
+-----------------------+----------------------+
| Variable_name         | Value                |
+-----------------------+----------------------+
| Ssl_ctx_verify_depth  | 18446744073709551615 |
| wsrep_cluster_conf_id | 18446744073709551615 |
| wsrep_local_index     | 18446744073709551615 |
+-----------------------+----------------------+
3 rows in set, 35 warnings (0.002 sec)

All three have values that are 2**64 - 1. Could the variables not be initialized correctly?



 Comments   
Comment by Daniel Black [ 2021-07-29 ]

Ssl_ctx_verify_depth returns the value of the ssl library using the SSL_get_verify_depth https://www.openssl.org/docs/manmaster/man3/SSL_get_verify_depth.html where -1 is wrapped to the maximum. It does however mean the SSL default depth. It won't reach that high as you won't place an arbitrarily length CA chain on the server.

The wsrep values look like an arbitrary number, however once you enable galera these will have much saner looking values.

Comment by Louka Dlagnekov (Inactive) [ 2021-08-04 ]

Thanks so much for the info, Daniel. That makes perfect sense.

Comment by Louka Dlagnekov (Inactive) [ 2021-08-06 ]

Sorry, reopening this, because we are sometimes seeing strange values for other variables, like Innodb_os_log_pending_writes. Sometimes the value is 0, other times it is 18446744073709552000. For an unsigned 64-bit integer, that's -384. What could explain that?

Comment by Marko Mäkelä [ 2022-06-15 ]

The status variable Innodb_os_log_pending_writes was removed in MDEV-14425 (MariaDB Server 10.8.0). Another user is reporting seeing negative or wrapped values for it in 10.5.15 but not 10.3.28.

Comment by Marko Mäkelä [ 2022-06-15 ]

A possible explanation for the wrap-around of InnoDB_os_log_pending_writes could be that srv_stats.os_log_pending_writes is essentially declared as size_t, not std::atomic<size_t>. So, race conditions between increment and decrement operations are possible.

Theoretically, we could ‘fix’ this by always reporting the status variable as 0 in releases older than 10.8, but then someone could be upset about it. I think that using proper std::atomic declaration is out of the question, because it would very likely introduce performance degradation.

Generated at Thu Feb 08 09:44:05 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.