Skip to content

Avoid cached data between plugin generation #31308

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

Merged
merged 3 commits into from
May 20, 2025

Conversation

emanuel2258
Copy link
Contributor

@emanuel2258 emanuel2258 commented Apr 18, 2025

Created a private static method that re‑initializes every static field used to hold merge state and it's used to ensuring each invocation begins with a clean slate, regardless of any prior merges.

Fixes #31263

@emanuel2258 emanuel2258 added in:Web Components release bug This bug is present in a released version of Open Liberty team:Sirius labels Apr 18, 2025
@emanuel2258 emanuel2258 self-assigned this Apr 18, 2025
@emanuel2258 emanuel2258 requested a review from pnicolucci April 18, 2025 14:25
@emanuel2258
Copy link
Contributor Author

emanuel2258 commented Apr 18, 2025

!build
(view Open Liberty Personal Build - ❌ completed with errors/failures.)
spawn.fullfat.buckets=com.ibm.ws.webserver.plugin.utility_fat

Note: Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

Code analysis and actions

DO NOT DELETE THIS COMMENT.
  • 1 product code files were changed.
  • Please describe in a separate comment how you tested your changes.

Copy link
Member

@pnicolucci pnicolucci left a comment

Choose a reason for hiding this comment

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

static was added here: #24627 we need to understand why that was. If these variables don't need to be static we should fix that. If we have test failures we need to understand why and determine a solution.

@volosied
Copy link
Member

I encounter failures when I change private PluginInfo[] plugins variable to non-static.

A clue as to why this variable needs to be static is how the merge tool is used, via a singleton-ish pattern:

PluginMergeToolImpl toolInstance = new PluginMergeToolImpl(); within the merge(String argv[]) method. After toolInstance is created, plugins = new PluginInfo[fileList.length]; is made.

Another place to look at is where plugins = new PluginInfo[files.length - 1]; was initialized. Before it was in the loadData method, but now it's within merge method.

This plugins object would then be accessible by toolInstance since it's static. If it's not static, then you'll hit NPEs (Caused by: java.lang.NullPointerException: Cannot read the array length because "this.plugins" is null).

I have a branch here with some local changes for testing: https://github.com/volosied/open-liberty/tree/TS018131209-vlad

The 789a331 commit has all tests passing while the c9fc73d commit has only the testEndpointTest3 test failing.

@emanuel2258
Copy link
Contributor Author

emanuel2258 commented Apr 25, 2025

I made a new commit to the PR. I reverted a lot of the static variables to instance state instead of resetting the state as a work around. When I say reverted I mean compared to what it was prior to PR #24627. There is only one variable that was left static sharedPlugins. If I modified it to non-static it would cause problems in one of the tests in com.ibm.ws.webserver.plugin.utility_fat, so had the potential to regress. But if I leave it as static it still causes problems for the customer’s issue because I would still get cached data. In order to get around this I had to add sharedPlugins = new ArrayList<PluginInfo>(); at the beginning of the merge function. Please take a look when you can and let me know if you want me to modify anything else.

Copy link
Member

@pnicolucci pnicolucci left a comment

Choose a reason for hiding this comment

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

I'd like to see a test added as well

@emanuel2258 emanuel2258 force-pushed the TS018131209 branch 2 times, most recently from 2fe905d to 56d0b8b Compare April 30, 2025 19:13
Copy link
Member

@pnicolucci pnicolucci left a comment

Choose a reason for hiding this comment

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

Cleaning up your commit history would be great, there are commits there with descriptions that don't make sense any longer as the design of the fix has changed since some of the commits were added. Adding a test case as we've discussed would be excellent as well.

@pnicolucci pnicolucci self-requested a review May 2, 2025 12:42
@emanuel2258 emanuel2258 force-pushed the TS018131209 branch 2 times, most recently from f1c9428 to f3b9f8d Compare May 5, 2025 19:32
@emanuel2258
Copy link
Contributor Author

emanuel2258 commented May 6, 2025

@pnicolucci I made the requested code changes and cleaned up the commit you mentioned. In terms of the test do you recommend I add it to the testbucket com.ibm.ws.webserver.plugin.runtime_fat in closed liberty or creating a new one? It seems this test bucket already covers some test for pluginUtility cluster generate so wonder if I just add to it.

@emanuel2258
Copy link
Contributor Author

emanuel2258 commented May 6, 2025

I did have a discussion with Eric this morning regarding the code changes and he seemed ok with them. I went ahead and created a testFix for the customer.

@pnicolucci
Copy link
Member

@pnicolucci I made the requested code changes and cleaned up the commit you mentioned. In terms of the test do you recommend I add it to the testbucket com.ibm.ws.webserver.plugin.runtime_fat in closed liberty or creating a new one? It seems this test bucket already covers some test for pluginUtility cluster generate so wonder if I just add to it.

If we have an existing bucket where it makes sense to add these tests then I have no objection to using that existing FAT project. Let me know if you have any other questions.

@emanuel2258
Copy link
Contributor Author

emanuel2258 commented May 9, 2025

@pnicolucci as requested, I have added a cached plugin-cfg.xml regeneration test in https://github.ibm.com/websphere/WS-CD-Open/pull/34255

@emanuel2258
Copy link
Contributor Author

@pnicolucci The customer came back saying the testFix worked for them. Is there any remaining items that are necessary for the approval of this PR or can it be approved?

@pnicolucci
Copy link
Member

pnicolucci commented May 17, 2025

!build (view Open Liberty Personal Build - ❌ completed with errors/failures.)

Note: Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

Code analysis and actions

DO NOT DELETE THIS COMMENT.
  • 1 product code files were changed.
  • Please describe in a separate comment how you tested your changes.

@emanuel2258
Copy link
Contributor Author

emanuel2258 commented May 19, 2025

!build (view Open Liberty Personal Build - ❌ completed with errors/failures.)

Note: Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

Code analysis and actions

DO NOT DELETE THIS COMMENT.
  • 1 product code files were changed.
  • Please describe in a separate comment how you tested your changes.

@emanuel2258
Copy link
Contributor Author

emanuel2258 commented May 20, 2025

!build (view Open Liberty Personal Build - ❌ completed with errors/failures.)

Note: Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

Code analysis and actions

DO NOT DELETE THIS COMMENT.
  • 1 product code files were changed.
  • Please describe in a separate comment how you tested your changes.

@emanuel2258
Copy link
Contributor Author

image Plugin test looks ok. Will merge the PR.

@emanuel2258 emanuel2258 merged commit e047746 into OpenLiberty:integration May 20, 2025
2 of 3 checks passed
@emanuel2258 emanuel2258 deleted the TS018131209 branch May 20, 2025 20:05
@emanuel2258 emanuel2258 moved this to Completed Tasks in Web Tier Team May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed in:Web Components release bug This bug is present in a released version of Open Liberty team:Sirius
Projects
Status: Completed Tasks
Development

Successfully merging this pull request may close these issues.

Plugin Config generation caching issues
4 participants