[MDEV-14257] Possible file descriptor leak @ libmariadbclient18 + YaSSL Created: 2017-11-02  Updated: 2017-11-12  Resolved: 2017-11-12

Status: Closed
Project: MariaDB Server
Component/s: SSL
Affects Version/s: 10.1
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Georgi Nikolov Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: None


 Description   

Hello,

I've found that MySQL client @ MariaDB leaves one file descriptor open.

OS is Debian Stretch.
Perl is v5.24.1

A quick one-liner for proof:

perl -MDBI -e 'my ($host, $port, $user, $pass, $db) = ("some.remote.host", 3306, "user", "pass", "dbname"); $dbh = DBI->connect("DBI:mysql:database=$db;host=$host;port=$port;mysql_ssl=1", $user, $pass); $dbh->disconnect(); print `ls -l /proc/$$/fd | fgrep urandom`;'

This results to:

lr-x------ 1 root root 64 Nov  2 14:31 5 -> /dev/urandom

With mysql_ssl=0 everything is fine.
I suspect that we hit some YaSSL clean-up bug. But cannot claim this for sure.
Thanks.



 Comments   
Comment by Elena Stepanova [ 2017-11-11 ]

There is no MySQL client in the scenario at all, only the server and DBI.

I don't see much of a leak here – perl process keeps one urandom, it closes all others if you open several connections at once and closes it. Server also seems to keep one urandom.

Still, I'll leave it to serg to decide whether there is a problem here. Technically, it's easily reproducible e.g. on MariaDB server installed from the Debian repo on Stretch (thus I'm setting the affect/fix version to 10.1, otherwise arbitrarily).

Comment by Sergei Golubchik [ 2017-11-12 ]

I don't think there's anything wrong here. Probably yassl opens /dev/urandom only once on the first use and closes it only when the library is unloaded. Seems reasonable, if it tries to avoid opening/closing /dev/urandom for every new connection.

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