Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When connection fails, a hanging anonymous inode is left open in the system #528

Open
b-nik opened this issue Mar 13, 2023 · 0 comments
Open

Comments

@b-nik
Copy link

b-nik commented Mar 13, 2023

Environment

Tested on:
Ubuntu 18.04 with freetds v.1.00.110 / TDS Version: 7.4
Ubuntu 20.04 with freetds v.1.2.12 / TDS Version: auto

Affected Gem Versions: all? (tested with 0.1.0, 0.7.0, 1.3.0, 2.1.2, 2.1.5)

Description

When connection fails, a hanging anonymous inode is left open in the system.

How to reproduce:

  1. Run Rails console - take note of the process pid.
  2. On a separate terminal run: lsof -p PID_HERE | grep eventfd - nothing should appear
  3. In Rails console run TinyTds::Client.new(host: "localhost") or anything that would fail
  4. On a separate terminal run: lsof -p PID_HERE | grep eventfd - you'll see an inode entry.
  5. Keep running step 3 and 4 and you'll see inode entries will keep appearing, never closing.
  6. Close the terminal - all inodes are now freed.
  7. If on step 3 you run a TinyTds::Client.new that succeeds the inode entry only remains until you close the connection. If the connection fails, there's no way to free the resource since TinyTds::Client.new returns an exception.

On a production environment TinyTds ran in a sidekiq job - some times it would fail to connect, and eventually that left so many open inodes that sidekiq would fail most jobs with a "too many open files error".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant