Bug #14056
closedCannot modify groups when workflow are enabled
Description
When creating a change request, it fails with the error message
There was problem with your request. could not save change request Save Group XXXX <- Couldn't find newly created entry when saving Change Request
in the postgresql logs, we have
2018-12-28 16:26:55 CET [2905-189] rudder@rudder LOG: execute S_1: COMMIT 2018-12-28 16:26:57 CET [2905-190] rudder@rudder LOG: execute S_3: BEGIN 2018-12-28 16:26:57 CET [2905-191] rudder@rudder LOG: execute <unnamed>: insert into ChangeRequest (name, description, creationTime, content, modificationId) values ($1, $2, $3, $4, $5) RETURNING "id" 2018-12-28 16:26:57 CET [2905-192] rudder@rudder DETAIL: parameters: $1 = 'Save Group XXXXXX', $2 = '', $3 = '2018-12-28 16:26:57.616+01', $4 = '<changeRequest fileFormat="6"><groups><group id="4c395876-db0b-4cd2-b48c-a370a1e56f11"><initialState><nodeGroup fileFormat="6"><id>6b536c1a-4389-4aca-b5bb-156f87da37bb)</id><displayName>nXXXXXXXXX</displayName><description></description><query>{"select":"node","composition":"And","where":[]}</query><isDynamic>true</isDynamic><nodeIds/><isEnabled>true</isEnabled><isSystem>false</isSystem></nodeGroup></initialState><firstChange><change><actor>admin</actor><date>2018-12-28T16:26:51.515+01:00</date><reason></reason><diff action="modifyTo"><nodeGroup fileFormat="6"><id>6b536c1a-4389-4aca-b5bb-156f87da37bb)</id><displayName>XXXXXXXXXX</displayName><description>xxxxxxx</description><query>{"select":"node","composition":"And","where":[]}</query><isDynamic>true</isDynamic><nodeIds/><isEnabled>true</isEnabled><isSystem>false</isSystem></nodeGroup></diff></change></firstChange><nextChanges/></group></groups><directives/><rules/><globalParameters/></changeRequest>', $5 = '' 2018-12-28 16:26:57 CET [2905-193] rudder@rudder LOG: execute S_6: ROLLBACK 2018-12-28 16:27:01 CET [2905-194] rudder@rudder LOG: execute S_3: BEGIN 2018-12-28 16:27:01 CET [2905-195] rudder@rudder LOG: execute <unnamed>: SELECT 1 2018-12-28 16:27:01 CET [2905-196] rudder@rudder LOG: execute <unnamed>: SELECT id, name, description, creationTime, content, modificationId FROM ChangeRequest where id = $1 2018-12-28 16:27:01 CET [2905-197] rudder@rudder DETAIL: parameters: $1 = '8' 2018-12-28 16:27:01 CET [2905-198] rudder@rudder LOG: execute S_6: ROLLBACK 2018-12-28 16:27:01 CET [2905-199] rudder@rudder LOG: execute S_3: BEGIN 2018-12-28 16:27:01 CET [2905-200] rudder@rudder LOG: execute <unnamed>: SELECT CR.id
manually executing the query succeed.
reverting the change in #13582 solves the issue (setting query to auto commit)
Updated by Nicolas CHARLES almost 6 years ago
It only happens in 4.1.15, 4.1.16 and 4.1.17 (4.3 branch is immune)
Updated by Nicolas CHARLES almost 6 years ago
I tried to add connection.commit() at the end of the preparedStatement in createChangeRequest, without success
Setting connection.setAutoCommit(true) in the preparedStatement fails in a different way: the roRepo.get(ChangeRequestId(keyHolder.getKey().intValue)) cannot find the created entry, even if we see the database logs says
2018-12-28 17:44:27 CET [3613-223] rudder@rudder DETAIL: parameters: $1 = '494513', $2 = '2018-12-28 17:44:27.828+01', $3 = 'executionStatus' 2018-12-28 17:44:27 CET [3613-224] rudder@rudder LOG: execute S_1: COMMIT 2018-12-28 17:44:28 CET [3613-225] rudder@rudder LOG: execute S_3: BEGIN 2018-12-28 17:44:28 CET [3613-226] rudder@rudder LOG: execute <unnamed>: SELECT 1 2018-12-28 17:44:28 CET [3613-227] rudder@rudder LOG: execute S_1: COMMIT 2018-12-28 17:44:28 CET [3613-228] rudder@rudder LOG: execute <unnamed>: insert into ChangeRequest (name, description, creationTime, content, modificationId) values ($1, $2, $3, $4, $5) RETURNING "id" 2018-12-28 17:44:28 CET [3613-229] rudder@rudder DETAIL: parameters: $1 = 'Save Group node-git-cve', $2 = '', $3 = '2018-12-28 17:44:28.814+01', $4 = '<changeRequest fileFormat="6"><groups><group id="4c395876-db0b-4cd2-b48c-a370a1e56f11"><initialState><nodeGroup fileFormat="6"><id>6b536c1a-4389-4aca-b5bb-156f87da37bb)</id><displayName>node-git-cve</displayName><description></description><query>{"select":"node","composition":"And","where":[]}</query><isDynamic>true</isDynamic><nodeIds/><isEnabled>true</isEnabled><isSystem>false</isSystem></nodeGroup></initialState><firstChange><change><actor>admin</actor><date>2018-12-28T17:44:28.792+01:00</date><reason></reason><diff action="modifyTo"><nodeGroup fileFormat="6"><id>6b536c1a-4389-4aca-b5bb-156f87da37bb)</id><displayName>node-git-cve</displayName><description>git cve</description><query>{"select":"node","composition":"And","where":[]}</query><isDynamic>true</isDynamic><nodeIds/><isEnabled>true</isEnabled><isSystem>false</isSystem></nodeGroup></diff></change></firstChange><nextChanges/></group></groups><directives/><rules/><globalParameters/></changeRequest>', $5 = '' 2018-12-28 17:44:28 CET [3613-230] rudder@rudder LOG: execute S_3: BEGIN 2018-12-28 17:44:28 CET [3613-231] rudder@rudder LOG: execute <unnamed>: SELECT id, name, description, creationTime, content, modificationId FROM ChangeRequest where id = $1 2018-12-28 17:44:28 CET [3613-232] rudder@rudder DETAIL: parameters: $1 = '18' 2018-12-28 17:44:28 CET [3613-233] rudder@rudder LOG: execute S_6: ROLLBACK 2018-12-28 17:44:28 CET [3613-234] rudder@rudder LOG: execute S_3: BEGIN 2018-12-28 17:44:28 CET [3613-235] rudder@rudder LOG: execute <unnamed>: insert into eventlog (creationdate, modificationid, principal, eventtype, severity, data, reason, causeid) values($1, $2, $3, $4, $5, $6, $7, $8 ) RETURNING "id" 2018-12-28 17:44:28 CET [3613-236] rudder@rudder DETAIL: parameters: $1 = '2018-12-28 17:44:28.859+01', $2 = 'e7532a9c-8ad7-4af6-8c0e-b97b2a9d33f6', $3 = 'admin', $4 = 'ChangeRequestAdded', $5 = '100', $6 = '<entry><changeRequest changeType="add"><id>18</id><name>Save Group node-git-cve</name><description></description></changeRequest></entry>', $7 = '', $8 = NULL 2018-12-28 17:44:28 CET [3613-237] rudder@rudder LOG: execute S_1: COMMIT 2018-12-28 17:44:28 CET [3613-238] rudder@rudder LOG: execute S_3: BEGIN 2018-12-28 17:44:28 CET [3613-239] rudder@rudder LOG: execute <unnamed>: SELECT id, state FROM Workflow WHERE id = $1 2018-12-28 17:44:28 CET [3613-240] rudder@rudder DETAIL: parameters: $1 = '18' 2018-12-28 17:44:28 CET [3613-241] rudder@rudder LOG: execute S_6: ROLLBACK 2018-12-28 17:44:28 CET [3613-242] rudder@rudder LOG: execute S_3: BEGIN 2018-12-28 17:44:28 CET [3613-243] rudder@rudder LOG: execute <unnamed>: INSERT into Workflow (id, state) values ($1, $2) 2018-12-28 17:44:28 CET [3613-244] rudder@rudder DETAIL: parameters: $1 = '18', $2 = 'Pending validation' 2018-12-28 17:44:28 CET [3613-245] rudder@rudder LOG: execute S_6: ROLLBACK 2018-12-28 17:44:28 CET [3613-246] rudder@rudder LOG: execute S_3: BEGIN 2018-12-28 17:44:28 CET [3613-247] rudder@rudder LOG: execute <unnamed>: SELECT id, state FROM Workflow WHERE id = $1 2018-12-28 17:44:28 CET [3613-248] rudder@rudder DETAIL: parameters: $1 = '18' 2018-12-28 17:44:28 CET [3613-249] rudder@rudder LOG: execute S_6: ROLLBACK 2018-12-28 17:44:28 CET [3613-250] rudder@rudder LOG: execute S_3: BEGIN 2018-12-28 17:44:28 CET [3613-251] rudder@rudder LOG: execute <unnamed>: SELECT CR.id, name, description, creationTime, content, modificationId FROM changeRequest CR LEFT JOIN workflow W on CR.id = W.id where cast( xpath('/changeRequest/groups/group/@id', content) as text[]) = $1 and state like 'Pending%' 2018-12-28 17:44:28 CET [3613-252] rudder@rudder DETAIL: parameters: $1 = '{4c395876-db0b-4cd2-b48c-a370a1e56f11}' 2018-12-28 17:44:28 CET [3613-253] rudder@rudder LOG: execute S_6: ROLLBACK 2018-12-28 17:44:32 CET [3613-254] rudder@rudder LOG: execute S_3: BEGIN 2018-12-28 17:44:32 CET [3613-255] rudder@rudder LOG: execute <unnamed>: SELECT 1 2018-12-28 17:44:32 CET [3613-256] rudder@rudder LOG: execute S_2: select lastid, date from statusupdate where key=$1
and in the database
id | name | description | creationtime | content | modificationid ----+-------------------------+-------------+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------- 18 | Save Group node-git-cve | | 2018-12-28 17:44:28.814+01 | <changeRequest fileFormat="6"><groups><group id="4c395876-db0b-4cd2-b48c-a370a1e56f11"><initialState><nodeGroup fileFormat="6"><id>6b536c1a-4389-4aca-b5bb-156f87da37bb)</id><displayName>node-git-cve</displayName><description></description><query>{"select":"node","composition":"And","where":[]}</query><isDynamic>true</isDynamic><nodeIds/><isEnabled>true</isEnabled><isSystem>false</isSystem></nodeGroup></initialState><firstChange><change><actor>admin</actor><date>2018-12-28T17:44:28.792+01:00</date><reason></reason><diff action="modifyTo"><nodeGroup fileFormat="6"><id>6b536c1a-4389-4aca-b5bb-156f87da37bb)</id><displayName>node-git-cve</displayName><description>git cve</description><query>{"select":"node","composition":"And","where":[]}</query><isDynamic>true</isDynamic><nodeIds/><isEnabled>true</isEnabled><isSystem>false</isSystem></nodeGroup></diff></change></firstChange><nextChanges/></group></groups><directives/><rules/><globalParameters/></changeRequest> | (1 row)
Updated by Nicolas CHARLES almost 6 years ago
- Related to Bug #13582: Hikari pool autocomit configuration is incorrect, which can impact performance added
Updated by Nicolas CHARLES almost 6 years ago
tried with the nefarious @Transactional, without success either
Updated by Nicolas CHARLES almost 6 years ago
- Translation missing: en.field_tag_list set to Sponsored
- Severity set to Major - prevents use of part of Rudder | no simple workaround
- User visibility set to Operational - other Techniques | Rudder settings | Plugins
- Priority changed from 0 to 84
Updated by François ARMAND almost 6 years ago
We are reverting the autocommit property in branch 4.1 only.
Updated by François ARMAND almost 6 years ago
- Status changed from New to In progress
- Assignee set to François ARMAND
Updated by François ARMAND almost 6 years ago
- Status changed from In progress to Pending technical review
- Assignee changed from François ARMAND to Vincent MEMBRÉ
- Pull Request set to https://github.com/Normation/rudder/pull/2106
Updated by François ARMAND almost 6 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset rudder|7664b56448df5eae1b88fd7e37588ebc0acbaa7d.
Updated by François ARMAND almost 6 years ago
Applied in changeset rudder|c055c4f99906e3074cd1a00a71316759b2af39a2.
Updated by Vincent MEMBRÉ almost 6 years ago
- Subject changed from Change request cannot be created - "Couldn't find newly created entry when saving Change Request" to Cannot modify groups when workflow are enabled
Updated by Vincent MEMBRÉ almost 6 years ago
- Status changed from Pending release to Released