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

OSGi does not always init properly when adding Workflow Actionlets #30291

Closed
wezell opened this issue Oct 8, 2024 · 7 comments · Fixed by #30292, #30531 or #30648
Closed

OSGi does not always init properly when adding Workflow Actionlets #30291

wezell opened this issue Oct 8, 2024 · 7 comments · Fixed by #30292, #30531 or #30648

Comments

@wezell
Copy link
Contributor

wezell commented Oct 8, 2024

Parent Issue

No response

Problem Statement

When dotCMS is running with a plugin that provides a workflow action, and dotCMS gets restarted, there is a race condition between OSGi initing and the plugin trying to register the actionlet. If OSGI is fully initied, the actionlet will register. If not, the actionlet will not show up and the plugin needs to be manually re-added to be able to use the actionlet.

Steps to Reproduce

Its hard to reproduce because does not happen all the time.

  1. Basically, add a plugin that provides an actionlet
  2. Add the actionlet to a workflow action with some config
  3. Make sure it works
  4. restart dotCMS
  5. try the action again.

It especially happens if your felix-cache is persisted across restarts.

Acceptance Criteria

make this not happen

dotCMS Version

24.09

Proposed Objective

Quality Assurance

Proposed Priority

Priority 2 - Important

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

wezell added a commit that referenced this issue Oct 8, 2024
wezell added a commit that referenced this issue Oct 8, 2024
wezell added a commit that referenced this issue Oct 8, 2024
wezell added a commit that referenced this issue Oct 8, 2024
wezell added a commit that referenced this issue Oct 8, 2024
wezell added a commit that referenced this issue Oct 9, 2024
wezell added a commit that referenced this issue Oct 9, 2024
@wezell wezell linked a pull request Oct 9, 2024 that will close this issue
@wezell wezell added LTS: Needs Backport Ticket that will be added to LTS Team : Falcon labels Oct 9, 2024
@github-project-automation github-project-automation bot moved this from New to Internal QA in dotCMS - Product Planning Oct 9, 2024
@dsilvam
Copy link
Contributor

dsilvam commented Oct 22, 2024

Failed IQA: Still requires a redeployment of the plugin that includes actionlets for them to get installed/added.

First time:

dotcms-1      | 21:13:43.929  WARN  rules.RulesAPIImpl - Actionlet with name 'CountRulesActionlet' already registered.
dotcms-1      | 21:13:43.930  WARN  rules.RulesAPIImpl - Actionlet with name 'SetSessionAttributeActionlet' already registered.
dotcms-1      | 21:13:43.930  WARN  rules.RulesAPIImpl - Actionlet with name 'SetRequestAttributeActionlet' already registered.
dotcms-1      | 21:13:43.930  WARN  rules.RulesAPIImpl - Actionlet with name 'SetResponseHeaderActionlet' already registered.
dotcms-1      | 21:13:43.930  WARN  rules.RulesAPIImpl - Actionlet with name 'PersonaActionlet' already registered.
dotcms-1      | 21:13:43.930  WARN  rules.RulesAPIImpl - Actionlet with name 'VisitorTagsActionlet' already registered.
dotcms-1      | 21:13:43.930  WARN  rules.RulesAPIImpl - Actionlet with name 'SendRedirectActionlet' already registered.
dotcms-1      | 21:13:43.930  WARN  rules.RulesAPIImpl - Actionlet with name 'StopProcessingActionlet' already registered.
db-1          | 2024-10-22 21:13:52.246 UTC [45] ERROR:  duplicate key value violates unique constraint "shedlock_pkey"
db-1          | 2024-10-22 21:13:52.246 UTC [45] DETAIL:  Key (name)=(osgi_restart_lock) already exists.
db-1          | 2024-10-22 21:13:52.246 UTC [45] STATEMENT:  INSERT INTO shedlock(name, lock_until, locked_at, locked_by) VALUES($1, $2, $3, $4)
dotcms-1      | 21:13:52.251  INFO  framework.OSGIUtil - Starting the osgi reload on folder: /data/shared/felix/upload
dotcms-1      | 21:13:52.251  INFO  framework.OSGIUtil - OSGI - pathname: vision-0.4.1.jar

After reapplying the plugin:

dotcms-1      | Installing bundle com.dotcms.ai.vision / 0.4.1
dotcms-1      | 21:28:41.696  INFO  vision.Activator - Added actionlet: Open AI - Tag Images
dotcms-1      | 21:28:41.700  INFO  vision.Activator - Added actionlet: Open AI - Translate Content
dotcms-1      | Started bundle: file:/data/shared/felix/load/vision-0.4.1.jar

@dsilvam dsilvam reopened this Oct 22, 2024
@github-project-automation github-project-automation bot moved this from Internal QA to Current Sprint Backlog in dotCMS - Product Planning Oct 22, 2024
@wezell
Copy link
Contributor Author

wezell commented Oct 22, 2024

Was this in a cluster and you hit the "reinit plugins"? If so, I think that it is another issue and not the original one.

@victoralfaro-dotcms victoralfaro-dotcms self-assigned this Oct 29, 2024
@victoralfaro-dotcms victoralfaro-dotcms moved this from Current Sprint Backlog to In Progress in dotCMS - Product Planning Oct 29, 2024
victoralfaro-dotcms added a commit that referenced this issue Oct 31, 2024
victoralfaro-dotcms added a commit that referenced this issue Oct 31, 2024
victoralfaro-dotcms added a commit that referenced this issue Oct 31, 2024
github-merge-queue bot pushed a commit that referenced this issue Nov 6, 2024
…any workflow actionlets (#30531)

To avoid possible race condition, the OSGI actionlets registration is
now preceded by a check that makes sure (after a reasonable number of
tries) that OSGI framework is fully loaded.
@victoralfaro-dotcms victoralfaro-dotcms moved this from In Progress to In Review in dotCMS - Product Planning Nov 6, 2024
@victoralfaro-dotcms victoralfaro-dotcms moved this from In Review to Internal QA in dotCMS - Product Planning Nov 6, 2024
spbolton pushed a commit that referenced this issue Nov 11, 2024
…any workflow actionlets (#30531)

To avoid possible race condition, the OSGI actionlets registration is
now preceded by a check that makes sure (after a reasonable number of
tries) that OSGI framework is fully loaded.
@dsilvam
Copy link
Contributor

dsilvam commented Nov 11, 2024

Failed IQA: Still not loading actionlets consistently when the plugin is installed.

@dsilvam dsilvam removed their assignment Nov 11, 2024
@dsilvam dsilvam moved this from Internal QA to In Progress in dotCMS - Product Planning Nov 11, 2024
@wezell
Copy link
Contributor Author

wezell commented Nov 11, 2024

I think we are battling two issues. The original PR fixed the issue of an actionlet loading locally. The second issue is with the use of shedlock to reinit osgi in a cluster that prevents multiple nodes from reloading osgi correctly.

We should not be using shedlock here I don't think. I would be interested in the original reasoning for doing so.

@dsilvam
Copy link
Contributor

dsilvam commented Nov 14, 2024

Passed IQA:

Two starts of the plugin both correctly installing the actionlets:

1      | 22:14:33.440  INFO  servlet.ServletToolboxManager - Trying config file '/WEB-INF/toolbox.xml'
dotcms-1      | 22:14:33.582  INFO  servlet.ServletToolboxManager - Toolbox setup complete.
dotcms-1      | 22:14:33.587  INFO  vision.Activator - Added actionlet: [Open AI - Tag Images]
dotcms-1      | 22:14:33.592  INFO  vision.Activator - Added actionlet: [Open AI - Translate Content]
dotcms-1      | Started bundle: file:/data/shared/felix/load/vision-0.4.1.jar
dotcms-1      | 22:14:44.057  INFO  osgi.OSGIResource - Portlets Removed: []
dotcms-1      | 22:14:44.057  INFO  osgi.OSGIResource - Actionlets Removed: []
dotcms-1      | 22:14:54.146  INFO  vision.Activator - Added actionlet: [Open AI - Tag Images]
dotcms-1      | 22:14:54.149  INFO  vision.Activator - Added actionlet: [Open AI - Translate Content]

@dsilvam dsilvam moved this from Internal QA to QA - Backlog in dotCMS - Product Planning Nov 14, 2024
@josemejias11
Copy link
Contributor

Approved: Tested on trunk_3d77285, Docker, macOS 14.5, FF v126.0.1

@josemejias11 josemejias11 moved this from QA - In Progress to Done in dotCMS - Product Planning Nov 18, 2024
@dsilvam dsilvam closed this as completed Nov 27, 2024
@github-project-automation github-project-automation bot moved this from Done to Internal QA in dotCMS - Product Planning Nov 27, 2024
@dsilvam dsilvam moved this from Internal QA to Done in dotCMS - Product Planning Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment