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

Terminate Riemann::Tools::HttpCheck threads between tests #284

Merged
merged 2 commits into from
Jan 22, 2024

Conversation

smortex
Copy link
Member

@smortex smortex commented Jan 21, 2024

Under normal operation, we have a single instance of the Riemann::Tools::HttpCheck class for the lifetime of the monitoring process.

But when testing, we create a new instance for each test, each with its resolvers and worker thread pools. The test process will have more and more threads, until it eventually hit the OS limit of the maximum number of threads for a process and cause an exception:

ThreadError: can't create Thread: Resource temporarily unavailable

Make sure that the threads are terminated at the end of each test to avoid running out of resources if they are limited.

Also include:

The project dependencies now allow rack 3 to be installed.  This
backwards incompatible version extracted handlers in a new `rackup` gem.
While we could indicate we prefer to use rack 2 which is still receiving
update, it is more future-proof to update our code to be compatible with
the latest version of the dependency.

This is a development dependency only so will not affect users of the
project.
Under normal operation, we have a single instance of the
`Riemann::Tools::HttpCheck` class for the lifetime of the monitoring
process.

But when testing, we create a new instance for each test, each with its
resolvers and worker thread pools.  The test process will have more and
more threads, until it eventually hit the OS limit of the maximum number
of threads for a process and cause an exception:

> ThreadError: can't create Thread: Resource temporarily unavailable

Make sure that the threads are terminated at the end of each test to
avoid running out of resources if they are limited.
@smortex smortex added the skip-changelog Excluded from CHANGELOG label Jan 21, 2024
@jamtur01 jamtur01 merged commit c4f0df4 into main Jan 22, 2024
8 checks passed
@smortex smortex deleted the terminate-threads-in-tests branch January 22, 2024 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Excluded from CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants