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

Fix leaking goroutines in multiple integration tests #110264

Merged
merged 9 commits into from Jun 2, 2022

Conversation

wojtek-t
Copy link
Member

Ref #108483

Note to reviewer: I recommend reviewing commits one by one - they are all independent.

NONE

/kind cleanup
/priority important-longterm
/sig testing

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. sig/testing Categorizes an issue or PR as relevant to SIG Testing. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 28, 2022
@k8s-ci-robot
Copy link
Contributor

@wojtek-t: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added area/test approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 28, 2022

defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, true)()
_, instanceConfig, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
client, err := clientset.NewForConfig(&restclient.Config{Host: instanceConfig.URL, QPS: -1})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the -1 ?

@wojtek-t
Copy link
Member Author

/hold

Need to fix job tests.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 28, 2022
@wojtek-t wojtek-t force-pushed the fix_leaking_goroutines_4 branch 2 times, most recently from 3b952bc to 90e02d7 Compare May 28, 2022 18:54
@wojtek-t
Copy link
Member Author

should be fixed now

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 28, 2022
@k8s-ci-robot k8s-ci-robot added the sig/apps Categorizes an issue or PR as relevant to SIG Apps. label May 28, 2022
@k8s-ci-robot k8s-ci-robot added the sig/network Categorizes an issue or PR as relevant to SIG Network. label May 28, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wojtek-t

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@aojea
Copy link
Member

aojea commented May 29, 2022

/retest

@aojea
Copy link
Member

aojea commented May 29, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 29, 2022
@aojea
Copy link
Member

aojea commented May 29, 2022

/lgtm cancel

the test failure is legit, it seems the event action is not created with these changes

expectedNumActions: 2, // extra action for creating warning event

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 29, 2022
@aojea
Copy link
Member

aojea commented May 29, 2022

it seems the test doesn't call Run on the controllers, maybe we should call it here

client, esController := newController(time.Duration(0))

and defer the shutdown

@wojtek-t
Copy link
Member Author

@aojea - fixed the test
[the unit test is still leaking the goroutine, but so are many other unit tests in bunch of places - I want to limit the scope to make some progress without regressing other things - which is the case now]

PTAL

@wojtek-t
Copy link
Member Author

wojtek-t commented Jun 1, 2022

@aojea - can you please take another look?

testCtx.informerFactory.Start(testCtx.scheduler.StopEverything)
testCtx.informerFactory.WaitForCacheSync(testCtx.scheduler.StopEverything)

go testCtx.scheduler.Run(testCtx.ctx)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ic, I've found it, the difference is that this helper started the scheduler inside,

@@ -99,8 +92,15 @@ func setupScheduler(
}

eventBroadcaster.StartRecordingToSink(ctx.Done())

go sched.Run(ctx)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will run without the informers started, is that something we should be worried?
it seems all the Run and Start are done later on the tests bodys

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, basically we are moving the

  // Start Scheduler
  setupScheduler(ctx, t, clientset, informers)

to setup , but it seems that the informers weren't started before this change , 🤷 technically should be the same

@aojea
Copy link
Member

aojea commented Jun 2, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 2, 2022
@k8s-ci-robot k8s-ci-robot merged commit 03d0e2c into kubernetes:master Jun 2, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.25 milestone Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants