Closed (fixed)
Project:
Rules
Version:
6.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Apr 2009 at 01:03 UTC
Updated:
29 Jun 2009 at 17:10 UTC
These 3 issues might have to do with the rules module and how I use it.
#444947: Duplicate entry error
#445034: Duplicate entry error when saving a node with rules.module
#270777: Duplicate entry when saving a node with rules.module
Here's the rule
Event: After saving new content
Actions: Save a content
Comments
Comment #1
mitchell commented@mikeytown2: This seems like a complex issue. Can you please help isolate the problem by providing an export of your rule, describing your setup (php version, mysql, apache version, etc), and further test from a clean Drupal site to see at what exact point this error occurs?
Comment #2
mikeytown2 commentedPHP 5.2.5
mySQL 5.0.18
Apache 1.3.33
Shared Godaddy hosting
Exported Rule
More info on the error from the xmlsitemap maintainer
http://drupal.org/node/270777#comment-1519816
How to replicate error.
Install one of the 3 modules below
http://drupal.org/project/search_block - 6.x 1.x dev
http://drupal.org/project/nodereferrer & CCK node reference
http://drupal.org/project/xmlsitemap - 6.x 1.x dev
Have the above rule active
Create a node
Comment #3
avpadernoI imported the rule into the test Drupal site I use on my PC, and saved three different nodes with taxonomy terms created by devel.module.
I didn't get any error messages, and there aren't any errors in the Drupal reports page.
Comment #4
avpadernoIn the test site I have CCK, Token, XML Sitemap, Rules, and Flag are enabled; the content types of the nodes I saved are the default ones installed together with Drupal (story, and page).
Comment #5
avpadernoDid you try changing the event associated with the rule?
Comment #6
mikeytown2 commentedHere's my test site setup & I can make it throw an error in xmlsitemap
Default 6.10 install
Enabled modules:
Tokens
Token actions
Rules
Rules Administration UI
XML Sitemap
XML Sitemap: Node
Created a rule
Event: Node -> After saving new content
Actions: Node -> Save a content
Create a page and this is the error I get
Comment #7
avpadernoIf this issue would be confirmed (actually it's just a person to report it), it would be related with the use of this module, as XML Sitemap doesn't throw that error when normally saving a node.
It still to see which module causes the error, but it's surely a module that is causing some hook implementation to be called twice; in the case of XML Sitemap, it seems that
hook_nodeapi()is invoked once more.Comment #8
fagooh, I see what the problem is. It occurs when a module reacts on node-insert and saves the fresh node. So any modules that come later on nodeapi-insert would receive first an update and then the initial insert.
--> Node Creation
--> Nodeapi Insert
--> Rule reacts and saves node
--> Node update
--> Nodeapi update
--> Nodeapi Insert end
We could resolve the issue by increasing the module weight of rules, so it comes (hopefully) after most of the modules.
Comment #9
mitchell commentedimo, this is a duplicate of #362616: Rules module weight of 0 leads to problems and/or #199210: forms support.
Comment #10
fagoIndeed #362616: Rules module weight of 0 leads to problems is related, but I prefer to keep this one - so people getting this errors can find it. I think we should increase the module weight. Any suggestions which value would be good?
Comment #11
avpadernoThe value of the weight for Rules depends on the maximum weight adopted from the other modules; for this reason it's not an immutable value.
I would try with 20, to start; it's big enough to be used without any changes for long time, I think.
Could not the weight of the module be dynamically changed? In that way, if some future modules will use a higher weight, the module is able to adapt itself to the environment conditions (it seems like the module is getting alive ;-)).
Comment #12
mitchell commented+1 for starting with 20
+1 for cognitive reasoning later
:-)
Comment #13
fagook, I've set it to 20.
Comment #15
AlexisWilke commentedNote that there is a module that uses 99 because (it thinks) it has to be executed last. FYI, it is called jquery_update.
That cognitive reasoning would break everything!
Just wanted to let you know.
I do not know of a good way to handle module order because there can always be a module that thinks it has to be loaded last...
Thank you.
Alexis