PICloudClient::internalDisconnect() cleared buff without mutex_buff while the eth read thread appends to it concurrently (close() races with in-flight Data frames), and bytesAvailable() read buff.size() lock-free on both PICloudClient and PICloudServer::Client. Take the lock in both places (mutex_buff made mutable for the const getter).