Help with weird issue incrementing site setting value?

Created on 30 March 2023, over 1 year ago
Updated 18 April 2023, over 1 year ago

Short context :
I am using ECA to automate some data entry in a node whenever I am saving said node.
I am using the "on saving", then checking if that node was not set to status "completed" then gets set to "status completed"
It then proceed to add the current "year" value to its field (all of this so far works 100% of the time)
Then I increment a variable stored in "site settings" by one
Then on one side, i store this new incremented variable back in site setting
and on the other side I load this new variable and store it into the node getting saved
(hopefully i am being clear enough)

Problem I get :
Somehow, every once in a while, the "increment" part does not work. the variable stays at its current value, does not get updated in the site settings, and the non-incremented value gets stored in the node. So basically only the increment part is getting skipped.

It is not urgent because I can manually edit the site settings AND the node value whenever i save a new one and increment by one manually.

And the weirdest part is that SOMETIMES it works perfectly!! It "seems" to be the days when i run composer update, after which it will work for a week or two (until drupal core gets an update maybe)?

I will attach my ECA "model" if you wish to have a look.

I would be extremely grateful for any kind of assistance!

Thank you for reading and have a nice day! :)

💬 Support request
Status

Fixed

Version

1.1

Component

Miscellaneous

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @FireHawkX
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Your model looks ok, can't see any obvious mistake. What could happen though, that more than 1 users are saving such an entity at the same time and then you get into a situation where those concurrent sessions overwrite values in the site-settings entity. Other than that, I can't see how this should behave differently from time to time. Any chance that such concurrent scenarios would be the cause of this?

    If not, it would be really helpful to make this somehow reproducible. I know this is hard, but it may be impossible to track this down otherwise.

  • I am the only user ever accessing the database/website so that scenario is not something that could happen in this case :)

    Is there any "log" or (new ECA node) that i could add to display any info that could help figure out why its not working?

    maybe ECA is trying to access and change the site settings variable using the "default" non authenticated user like it was with my other ECA model we troubleshooted last year? (Just checked) and we ended up adding a "set user uid to *me" at the very start of that one

  • 🇩🇪Germany jurgenhaas Gottmadingen

    OK, I thought that was the case but wanted to make sure about the concurrent users.

    As for debugging, there is the debug logging described here: https://ecaguide.org/eca/debugging/ That should give you all the details of what was going on for the most recent request, so there you can trace if any of the conditions did not assert or if there was any access denied for any of the actions.

    Note, if you're using the expert mode (recommended) there: when submitting an entity form, there is a POST request first which then redirects to a GET request right afterwards. The webprofiler toolbar shows you the data of the latest request, which is the GET request. But the ECA model ran in the previous one, the POST request. But the very left icon in the webprofiler toolbar gives you access to the profile data of the redirecting POST request as well, just if you wondered.

    As for the permission, that's a great thought. But in your case, I doubt this causes the problem as the ECA model is always processed under your user account as you are editing the node. And I assume that you have all the required permissions. Otherwise it would never actually work as expected.

  • oh i see. it make sense because the other ECA was being run by cron "daily" and not "when saving node"

    I have no idea if i am using "advanced" or not ;)
    (i am ULTRA noob) and do not use any actual "programming" in drupal, everything is done on the front end side with modules.

    I will have a look at that debugging page and see if i can gather more info

  • 🇩🇪Germany jurgenhaas Gottmadingen

    No worries, the debugging for ECA happens in the UI as well, no programming required. For the expert mode, you only need to install the webprofiler module and then the configuration and the log review is all in the UI.

  • Status changed to Postponed: needs info over 1 year ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    @FireHawkX any news on this, have you been successful in resolving your issue?

  • It is extremely "random"... AND i only use my games-list website to keep track of games I play with my wife and whenever I complete a new game... We have not completed a game since so I did not test it further yet...

    I just checked it out, and i have a much bigger issue (jquery isnt loading at all for some random reason) so everything is super broken...

    So I will be fixing that first, then testing out what happens with the logs that i had enabled the last time :)

  • Update :

    to fix my website, I redid a composer update and then re-did all the minify js manually.
    In regards to this, the file named "modules/contrib/bpmn_io/webpack/bpmn-modeller.js" which is used by ECA crashes minify js

    ---

    Then I set 1 game as "completed" and the ECA actually incremented the site value properly and savec/updated everything fine.

    (but as I wrote originally), most of the times after a composer update, it always worked... it stops working a few weeks/months after when we play a longer game ;)

    BUT at least it 100% worked this time. so if you wish, you can close this issue and if needs be, now that i have a full ECA log, i can reopen with more info if i ever get the issue again :)

  • Status changed to Fixed over 1 year ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thanks and congrats that you got it working.

    "modules/contrib/bpmn_io/webpack/bpmn-modeller.js" which is used by ECA crashes minify js

    Yes, that's why that file is marked as not to be minified in the libraries file of the bpmn_io module. As the BPMN UI us a backend tool only and won't be used in the frontend at any time, it doesn't have to be optimized the same way other tool's assets have to.

  • is there an "ignore" list that minify can have/add? cause it always crashes when it gets to that one file ;)

    Thanks for everything always!! :)

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Not sure how you do minification. Drupal's built-in preprocessing respects the setting in the bpmn_io.libraries.yml file:

    core:
      remote: https://github.com/bpmn-io/bpmn-js
      version: 11.0.5
      js:
        webpack/bpmn-modeller.js: { preprocess: false }
    

    Preprocessing is set to false, so that this file doesn't get touched.

  • I am using "drupal.org/project/minifyjs/"
    then i go to this page "/admin/config/development/performance/js"
    then use that to minify everything
    but this one only has to do "selected files" (which has 40+ pages of 100 files) or "ALL files" which then crashes when it gets to page 35 or so with that one file :)

    BUT its not related to ECA so you don't have to keep helping me! hehe... I'll figure it out ;)
    Thanks again!!

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Never mind ;-) This issue should be reported to the minifyjs's issue queue such that they respect the settings in the libraries settings. Or, if they can't do that, they should not fail/crash but handle such scenarios with more tolerance.

    I also found 💬 Minify already minified script? Fixed in their issue queue and the reporter mentions an exclude list. If that really exists, you could at least add the bpmn_io js file to that list, I would think.

  • This actually worked!! I added all 4 of those :
    *-min.js
    *.min.js
    bpmn-modeller.js
    modules/contrib/bpmn_io/webpack/bpmn-modeller.js

    to the ignore list, and it worked! no more minify errors! (and hopefully the ECA part keeps working) but if it doesnt, i have the logs so I can write back :)

    Thanks a lot once more!

  • I actually JUST updated a node from "playing" to "completed" and the bug occurred! the site integer value did not increase!

    I actually went back in the node afterwards and updated one other value and saved it again so this "double" save might show up, but only one of them should trigger ECA when i change from "playing" to "completed"

    Here is the full "log" for today :

    HawkX 	21:18:47 	Lazy appliance check for event eca.content_entity.presave regarding ECA ID process_hv3nnbu resulted to apply.
    - user (Entity user/19/HawkX)
    HawkX 	21:18:47 	Loading ECA configurations for event eca.content_entity.presave: process_hv3nnbu.
    - user (Entity user/19/HawkX)
    HawkX 	21:18:47 	Check On Saving (Event_0v54u0o) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    - user (Entity user/19/HawkX)
    HawkX 	21:18:47 	Start On Saving (Event_0v54u0o) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Check action successor AND (Activity_045dq0r) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    - entity (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - node (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - event (DTO)
      - machine-name (string "eca.content_entity.presave")
    - user (Entity user/19/HawkX)
    HawkX 	21:18:47 	Asserted condition Flow_0f9whwd for AND from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Execute AND (Activity_045dq0r) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Check action successor Set User UID to HawkX (Activity_0ckrzir) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    - entity (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - node (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - event (DTO)
      - machine-name (string "eca.content_entity.presave")
    - user (Entity user/19/HawkX)
    HawkX 	21:18:47 	Asserted condition Flow_0yj37aq for Set User UID to HawkX from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Execute Set User UID to HawkX (Activity_0ckrzir) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Check gateway successor noname (Gateway_1ux9mps) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    - entity (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - node (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - event (DTO)
      - machine-name (string "eca.content_entity.presave")
    - user (Entity user/19/HawkX)
    HawkX 	21:18:47 	Unconditional noname (Gateway_1ux9mps) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Execute noname (Gateway_1ux9mps) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Check action successor Set Completed Year (Activity_084wwx4) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    - entity (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - node (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - event (DTO)
      - machine-name (string "eca.content_entity.presave")
    - user (Entity user/19/HawkX)
    HawkX 	21:18:47 	Unconditional Set Completed Year (Activity_084wwx4) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Check action successor Increment Site ID value (Activity_0uyx02j) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    - entity (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - node (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - event (DTO)
      - machine-name (string "eca.content_entity.presave")
    - user (Entity user/19/HawkX)
    HawkX 	21:18:47 	Unconditional Increment Site ID value (Activity_0uyx02j) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Execute Set Completed Year (Activity_084wwx4) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Execute Increment Site ID value (Activity_0uyx02j) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Check action successor Set Completed ID (Activity_1y1dubb) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    - entity (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - node (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - event (DTO)
      - machine-name (string "eca.content_entity.presave")
    - new-completed-id (DTO "709")
    - user (Entity user/19/HawkX)
    HawkX 	21:18:47 	Unconditional Set Completed ID (Activity_1y1dubb) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Check action successor Load Site Settings (Activity_00vlr6j) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    - entity (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - node (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - event (DTO)
      - machine-name (string "eca.content_entity.presave")
    - new-completed-id (DTO "709")
    - user (Entity user/19/HawkX)
    HawkX 	21:18:47 	Unconditional Load Site Settings (Activity_00vlr6j) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Execute Set Completed ID (Activity_1y1dubb) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Execute Load Site Settings (Activity_00vlr6j) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Check action successor Set Completed ID (Activity_1uohpb6) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    - entity (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - node (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - event (DTO)
      - machine-name (string "eca.content_entity.presave")
    - new-completed-id (DTO "709")
    - site-setting-variable (Entity site_setting_entity/site_completed_id_storage/2/Site Completed ID Storage)
    - user (Entity user/19/HawkX)
    HawkX 	21:18:47 	Unconditional Set Completed ID (Activity_1uohpb6) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:18:47 	Execute Set Completed ID (Activity_1uohpb6) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:19:08 	Lazy appliance check for event eca.content_entity.presave regarding ECA ID process_hv3nnbu resulted to apply.
    - user (Entity user/19/HawkX)
    HawkX 	21:19:08 	Loading ECA configurations for event eca.content_entity.presave: process_hv3nnbu.
    - user (Entity user/19/HawkX)
    HawkX 	21:19:08 	Check On Saving (Event_0v54u0o) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    - user (Entity user/19/HawkX)
    HawkX 	21:19:08 	Start On Saving (Event_0v54u0o) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    HawkX 	21:19:08 	Check action successor AND (Activity_045dq0r) from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave.
    - entity (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - node (Entity node/video_game/899/Glory and Miserable Survivors DX)
    - event (DTO)
      - machine-name (string "eca.content_entity.presave")
    - user (Entity user/19/HawkX)
    HawkX 	21:19:08 	Not asserting condition Flow_0f9whwd for AND from ECA Update Year and ID On Save (process_hv3nnbu) for event Drupal\eca_content\Event\ContentEntityPreSave. 
  • 🇩🇪Germany jurgenhaas Gottmadingen

    And what should be a bug here? I think you may want to start a new issue for this, explaining what exactly went wrong and why you think, this is an ECA bug. From what I can see in the log, it says at the end Not asserting condition Flow_0f9whwd for AND ... which indicates that the condition that's being used in the ECA model returns FALSE and that's not a bug, it is just returning the result of a condition, that's by design and actually what you want, when you use conditions.

  • That is probably because I did it "twice"... the "end part" where the condition was false should probably be ignored (i just went back into the node and changed 1 value after) - so the 2nd time obviously the condition returned false as it should have.

    The first time (when it did return true) however, the issue was that the "site variable" did not increase by 1.
    This is 100% the same "issue" I was reporting at the top here.
    Looking at the image I shared originally :
    https://www.drupal.org/files/issues/2023-03-30/visual-representation-eca...
    The Site settings did not increment, the ID was saved, but with the old non-incremented value.
    So in that case its the "tamper math" that did not process properly for whatever reason.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    I'm getting confused. It feels like many different topics under a number of different contexts have been addressed which sometimes works and sometimes it doesn't.

    May I suggest that you start a new issue for addressing one (1) problem only and there you should provide a step-by-step description on how to reproduce the problem. If there is a model that lets others reproduce the problem, that can be uploaded, but it should be a model that has no other dependencies. Then we can have a look, if it's a bug or a mis-configuration in that model and fix that.

    If there is another issue that needs to be addressed, the same procedure applies to that one too, but again in a separate issue.

  • I am wondering if its because I am native french or being really unclear with my explanations...
    but there has only ever been a SINGLE issue I have tried to fix... ever...
    (sure we talked about how to setup the log files but that was never an actual "issue")

    I could copy paste the top #1 post of this, along with the 2 attachments, and the log... because honestly thats all you need.

    If you want me to restart in another one, I guess I can copy paste all of that in a new one, but since it is 100% the same thing since the very start, I don't understand why.

  • After having a friend review the thread for me,

    the minification stuff that was talked about (from #10 to #16) was only a secondary thing that was mentioned in regards to full fixing the site which did not have anything to do with the actual main issue from #1. You are correct that "that" part should have been a separate issue, but since it wasnt related to ECA at all, and the issue in #1 had not occurred again, I just kept "writing". I apologize.

    I thought the original issue was solved in #10. however the original issue started occurring again, which I mentioned in #17.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    That's all not wrong, but I'm not able to extract a reproducible use case out of the previous 22 comments. Please create something, that let's reproduce the problem on a fresh Drupal installation.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024