You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Anshul-creator (via GitHub)" <gi...@apache.org> on 2025/11/17 17:37:49 UTC

[PR] Fix: Stabilize `XmlSafetyTest` by filtering child `sleep 60` processes using baseline diff [dubbo]

Anshul-creator opened a new pull request, #15776:
URL: https://github.com/apache/dubbo/pull/15776

   ## What is the purpose of the change?
   
   This PR stabilizes `XmlSafetyTest` by removing environment-dependent flakiness in its process-inspection logic, while fully preserving the original test intention of detecting unsafe external command execution during XML deserialization.
   
   ## Root Cause
   
   `XmlSafetyTest` verifies that calling `XmlCodec.decode(...)` does not spawn external commands such as `sleep 60`.  
   However, the original validation logic had two issues:
   
   1. It checked for `"sleep"` in the entire `ps -e` output *after* execution, without using the `processesBefore` baseline captured in `prepare()`.
   2. It monitored **all system processes**, meaning the test failed if any unrelated `sleep` process was created by the OS, CI infrastructure, or other tests running concurrently.
   
   As a result, both `testSafe1` and `testSafe2` intermittently failed under randomized execution orders (NonDex) and on shared machines, even when `XmlCodec` did not spawn a process.
   
   ## Changes Made
   
   Only the `ProcessChecker` implementation was modified:
   
   - The current JVM PID is captured in `prepare()`.
   - `getProcesses()` was updated to only record processes where:
     - The **parent PID matches the JVM**, ensuring they are child processes, and
     - The command contains `"sleep"` **and** `"60"`, matching the attack payload.
   - The baseline comparison remains (`processesBefore` vs `processesAfter`), ensuring the test still fails if XML deserialization launches a new `sleep 60` process.
   
   ## Verification
   
   You can try running the following snippet of code from the dubbo repo root, on both pre-fix and post-fix code
   
   ```bash
   ./mvnw -pl dubbo-remoting/dubbo-remoting-http12 \
     edu.illinois:nondex-maven-plugin:2.2.1:nondex \
     -DnondexRuns=50 \
     -Dtest=org.apache.dubbo.remoting.http12.message.codec.XmlSafetyTest
   ```
   
   The test should fail intermittently on the pre-fix version, but pass consistently across all seeds on the post-fix version.
   NonDex run logs will be available under the `dubbo-remoting/dubbo-remoting-http12/.nondex` directory.
   
   ## Checklist
   - [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project.
   - [x] Make sure gitHub actions can pass. [Why the workflow is failing and how to fix it?](../CONTRIBUTING.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Fix: Stabilize `XmlSafetyTest` by filtering child `sleep 60` processes using baseline diff [dubbo]

Posted by "heliang666s (via GitHub)" <gi...@apache.org>.
heliang666s merged PR #15776:
URL: https://github.com/apache/dubbo/pull/15776


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Fix: Stabilize `XmlSafetyTest` by filtering child `sleep 60` processes using baseline diff [dubbo]

Posted by "heliang666s (via GitHub)" <gi...@apache.org>.
heliang666s commented on PR #15776:
URL: https://github.com/apache/dubbo/pull/15776#issuecomment-3561955168

   LGTM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Fix: Stabilize `XmlSafetyTest` by filtering child `sleep 60` processes using baseline diff [dubbo]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #15776:
URL: https://github.com/apache/dubbo/pull/15776#issuecomment-3543223403

   ## [Codecov](https://app.codecov.io/gh/apache/dubbo/pull/15776?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 29.62%. Comparing base ([`58d7386`](https://app.codecov.io/gh/apache/dubbo/commit/58d738682f02f0a315d72857b594eb9eace5e13d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`28cc0f1`](https://app.codecov.io/gh/apache/dubbo/commit/28cc0f1165c03d5c287b808f88ae7e99494daf4f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   > :exclamation:  There is a different number of reports uploaded between BASE (58d7386) and HEAD (28cc0f1). Click for more details.
   > 
   > <details><summary>HEAD has 8 uploads less than BASE</summary>
   >
   >| Flag | BASE (58d7386) | HEAD (28cc0f1) |
   >|------|------|------|
   >|samples-tests-java21|1|0|
   >|integration-tests-java8|1|0|
   >|integration-tests-java21|1|0|
   >|unit-tests-java8|1|0|
   >|unit-tests-java11|1|0|
   >|unit-tests-java25|1|0|
   >|unit-tests-java17|1|0|
   >|unit-tests-java21|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##                3.3   #15776       +/-   ##
   =============================================
   - Coverage     60.77%   29.62%   -31.15%     
   + Complexity    11706     9306     -2400     
   =============================================
     Files          1938     1937        -1     
     Lines         88646    88624       -22     
     Branches      13379    13295       -84     
   =============================================
   - Hits          53875    26256    -27619     
   - Misses        29249    58305    +29056     
   + Partials       5522     4063     -1459     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/dubbo/pull/15776/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [integration-tests-java21](https://app.codecov.io/gh/apache/dubbo/pull/15776/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/15776/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [samples-tests-java21](https://app.codecov.io/gh/apache/dubbo/pull/15776/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [samples-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/15776/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `29.62% <ø> (-0.11%)` | :arrow_down: |
   | [unit-tests-java11](https://app.codecov.io/gh/apache/dubbo/pull/15776/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java17](https://app.codecov.io/gh/apache/dubbo/pull/15776/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java21](https://app.codecov.io/gh/apache/dubbo/pull/15776/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java25](https://app.codecov.io/gh/apache/dubbo/pull/15776/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/15776/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/dubbo/pull/15776?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org