-
Notifications
You must be signed in to change notification settings - Fork 51
Fix data leak between publish calls #1841
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 data leak between publish calls #1841
Conversation
…() of type array|string is deprecated.
|
I think what is happening is that some class variables retain their values from one job to the next. So commit 256956c fixes this, you can run two consecutive publish jobs now. To be decided is if we want to be idealistic and work on and finish the tests, or accept this change and work on other stuff. |
…ait where it belongs now.
|
I just ran through a manual test again and this is working beautifully! As such, I'm opening it up for review. Thanks for the help @dsenalik ❤️ |
|
I tested both Single and Multiple publish with both the Main Tripal 4 and the tv4g1-issue1716-dataLeakBetweenPublishCalls branches and I notice there is no error message with the tv4g1-issue1716-dataLeakBetweenPublishCalls branch when using Single or Multiple content publications. There is no data leak between publish calls in the tv4g1-issue1716-dataLeakBetweenPublishCalls branch while the error is visible with current Tripal 4 main branch. |
|
Thanks @pdtouch for the review! That means this is ready to merge! |
Tripal 4 Core Dev Task
Issue #1716
Tripal Version: 4
Description
This PR fixes issues when you run two publish jobs in the same tripal job. Specifically, when you publish two content types in the same Tripal job, the values from the first publish are leaked into the second publish.
I believe this is happening due to some unwritten Drupal rule in how the TripalPublish service is written. I think it's related to the fact that this service uses an init() method to setup everything rather then typical dependency injection with a constructor... but I originally got so caught up in writing a test to demonstrate the problem that I couldn't get my brain to move on to finding the fix.
Luckily, after posting this as a draft PR and asking for help, @dsenalik realized that we could just reset the leaked values in the init() 😅 which is a really clean solution. It may not be ideal and we may run into other issues with this service in the future... but based on my understanding of what is happening, I do think it is a good, reliable fix :-) And I don't know what the ideal fix is so I say we go with this! 🤪
What exactly does this PR do?
Testing?
Setup Testing environment
Single publish job per call to job launcher works
When multiple publish jobs are in the queue, the second one fails.
From a fresh install of Tripal or a fresh docker container