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(JVMChaos): find the correct pid by CommName #2904

Merged
merged 1 commit into from
Feb 18, 2022

Conversation

imlonghao
Copy link
Contributor

@imlonghao imlonghao commented Feb 16, 2022

Signed-off-by: imlonghao git@imlonghao.com

What problem does this PR solve?

#2751

What's changed and how it works?

Read all the CommName from container, if the pid's CommName
is java\n then it is the correct pid to be injected.

Related changes

  • Need to update chaos-mesh/website
  • Need to update Dashboard UI
  • Need to cheery-pick to release branches
    • release-2.1
    • release-2.0

It is a bug fix so I think it need to be backported.

Checklist

Tests

  • Unit test
  • E2E test
  • No code
  • Manual test (add steps below)
  1. Build the chaos-daemon
  2. Deploy a java Pod which java pid is not 1
  3. Create a JVMChaos and see whether the inject is work

Side effects

  • Breaking backward compatibility

Release note

Please add a release note.

You can safely ignore this section if you don't think this PR needs a release note.

DCO

If you find the DCO check fails, please run commands like below (Depends on the actual situations. For example, if the failed commit isn't the most recent) to fix it:

git commit --amend --signoff
git push --force

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Feb 16, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • WangXiangUSTC
  • fewdan

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot
Copy link
Member

Welcome @imlonghao!

It looks like this is your first PR to chaos-mesh/chaos-mesh 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to chaos-mesh/chaos-mesh. 😃

@WangXiangUSTC WangXiangUSTC added the type/bug-fix A bug needs to be fixed. label Feb 17, 2022
Copy link
Contributor

@WangXiangUSTC WangXiangUSTC left a comment

Choose a reason for hiding this comment

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

rest LGTM, thanks!

pkg/chaosdaemon/jvm_server.go Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Feb 17, 2022

Codecov Report

Merging #2904 (ab8032e) into master (b4181f4) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2904      +/-   ##
==========================================
- Coverage   40.72%   40.69%   -0.04%     
==========================================
  Files         147      147              
  Lines       12033    12047      +14     
==========================================
+ Hits         4900     4902       +2     
- Misses       6765     6775      +10     
- Partials      368      370       +2     
Impacted Files Coverage Δ
pkg/chaosdaemon/jvm_server.go 0.00% <0.00%> (ø)
pkg/workflow/controllers/deadline_reconciler.go 64.44% <0.00%> (-5.19%) ⬇️
pkg/selector/generic/mode.go 25.64% <0.00%> (-2.57%) ⬇️
pkg/workflow/controllers/utils.go 85.71% <0.00%> (-1.59%) ⬇️
.../workflow/controllers/workflow_entry_reconciler.go 52.91% <0.00%> (+6.87%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b4181f4...ab8032e. Read the comment docs.

@imlonghao imlonghao force-pushed the issue/2751 branch 2 times, most recently from fe3e5ca to b57aa81 Compare February 17, 2022 13:35
Signed-off-by: imlonghao <git@imlonghao.com>
log.Error(err, "ReadCommName")
continue
}
if name == "java\n" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible that there are more than one java process in the container?

log.Error(err, "ReadCommName")
continue
}
if name == "java\n" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible that there are more than one java process in the container?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may be possible in threading case, but in this case, which process should be injected?

Copy link
Contributor

Choose a reason for hiding this comment

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

For this pr, I think injecting into the first java process is OK. Maybe we will add a new config like process-name later, and find a java process containing the process-name.

Copy link
Contributor

@WangXiangUSTC WangXiangUSTC left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@fewdan fewdan left a comment

Choose a reason for hiding this comment

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

LGTM

@fewdan
Copy link
Member

fewdan commented Feb 18, 2022

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: ab8032e

@ti-chi-bot ti-chi-bot merged commit 68e6ccb into chaos-mesh:master Feb 18, 2022
mikechengwei pushed a commit to mikechengwei/chaos-mesh that referenced this pull request Feb 21, 2022
Signed-off-by: imlonghao <git@imlonghao.com>
Signed-off-by: mikechengwei <842725815@qq.com>
@imlonghao imlonghao deleted the issue/2751 branch February 23, 2022 07:18
@WangXiangUSTC WangXiangUSTC mentioned this pull request Mar 8, 2022
9 tasks
afzal442 pushed a commit to afzal442/chaos-mesh that referenced this pull request Mar 19, 2022
Signed-off-by: imlonghao <git@imlonghao.com>
zhqqqy pushed a commit to zhqqqy/chaos-mesh that referenced this pull request Apr 10, 2022
Signed-off-by: imlonghao <git@imlonghao.com>
Signed-off-by: zhqqqy <zhqqqy@163.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-2.1 in PR #3336

ti-chi-bot pushed a commit that referenced this pull request Jun 8, 2022
* fix(JVMChaos): find the correct pid by CommName

Signed-off-by: imlonghao <git@imlonghao.com>

* docs: append changelog

Signed-off-by: STRRL <str_ruiling@outlook.com>

Co-authored-by: imlonghao <git@imlonghao.com>
Co-authored-by: STRRL <str_ruiling@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants