In a massively multi threaded environment, a SELECT query in a prepared statement does not return any data. The provided buffer is not written to by the libmariadbclient library. The data is retrieved using mysql_stmt_fetch() after the statement was initiated on a working connection, buffers bound and the query executed. The code worked as intended in at least version 10.1.35 (where the problem was a double free in libmysqlclient, thus the upgrade).
The query is as follows:
"SELECT id, address FROM addresses WHERE pool = ? AND identity = 0 LIMIT 1"
The query data is NOT cached on the client side. It is retrieved on-demand by the thread that consumes the data. Locking is not an issue in the code (what was previously reported in MDEV-16693).