-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Always cleanup agents after each test #9603
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach makes sense and should help us stabilise; I've added a note about how we can get the backtrace without going through a raise/rescue.
logstash-core/lib/logstash/agent.rb
Outdated
begin | ||
raise "fake" | ||
rescue => e | ||
CURRENT_INITIALIZED_BACKTRACE.set(e.backtrace); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can get the backtrace and avoid the overhead of raise/rescue with Kernel#caller, which also allows us to skip the current frame which will always be the same:
if (CURRENT.compare_and_set(nil,self))
backtrace = caller(1) # don't include the current frame
CURRENT_INITIALIZED_BACKTRACE.set(backtrace)
else
raise # ...
end
@@ -52,6 +52,17 @@ def puts(payload) | |||
example.run | |||
end | |||
end | |||
|
|||
c.after(:each) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much better 🎉
eeeb434
to
33ac41f
Compare
jenkins, please retest this |
jenkins, please retest this. |
jenkins, please test this |
jenkins, please retest this |
This code enforces a single active Agent at any time. It's not a singleton, since instances can be removed, but only one can be active. I'd say it's a pseudo-singleton. This is here to prevent one agent staying live and leaking its state causing another to fail in a different test. I'm not quite sure *how* this may be causing other tests to break, but it seems like a good sanity check for the time being since we do have some evidence of this. Some tests seem to fail when two agents, that shouldn't share PQs, somehow do. I suspect its a weird race when two agents are active.
33ac41f
to
d17c670
Compare
This code enforces a single active Agent at any time. It's not a singleton, since instances can be removed, but only one can be active.
I'd say it's a pseudo-singleton.
This is here to prevent one agent staying live and leaking its state causing another to fail in a different test.
I'm not quite sure how this may be causing other tests to break, but it seems like a good sanity check for the time being since we do have some evidence of this.
Some tests seem to fail when two agents, that shouldn't share PQs, somehow do. I suspect its a weird race when two agents are active.