Skip to content

Fix/move tab stored procedures to avoid concurrency issues#6633

Merged
valadas merged 3 commits intodnnsoftware:developfrom
timi-ty:fix/move-tab-proc-conc
Jul 29, 2025
Merged

Fix/move tab stored procedures to avoid concurrency issues#6633
valadas merged 3 commits intodnnsoftware:developfrom
timi-ty:fix/move-tab-proc-conc

Conversation

@timi-ty
Copy link
Copy Markdown
Contributor

@timi-ty timi-ty commented Jul 28, 2025

Closes issue #6384

Code Change Summary

Overview

Added SERIALIZABLE transaction isolation to three MovePage stored procedures in 10.01.00.SqlDataProvider to prevent race conditions that could create duplicate TabOrder values.

Files Modified

  • DNN Platform/Website/Providers/DataProviders/SqlDataProvider/10.01.00.SqlDataProvider

Changes Made

1. Transaction Isolation Level

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
  • Added to beginning of each procedure to force sequential execution
  • Prevents concurrent reads of the same TabOrder data

2. Explicit Transaction Management

BEGIN TRANSACTION
-- [Original procedure logic]
COMMIT TRANSACTION
  • Wrapped all operations in explicit transactions
  • Ensures atomicity of multi-step TabOrder updates

3. Error Handling

BEGIN TRY
    -- [Procedure logic]
    COMMIT TRANSACTION
END TRY
BEGIN CATCH
    ROLLBACK TRANSACTION
    THROW
END CATCH
  • Added comprehensive error handling with automatic rollback
  • Preserves database consistency on failures

Procedures Updated

  • MoveTabAfter: Move tab to position after specified tab
  • MoveTabBefore: Move tab to position before specified tab
  • MoveTabToParent: Move tab to new parent with automatic positioning

Key Benefits

  • Eliminates Race Conditions: Forces sequential execution of concurrent requests
  • Preserves Logic: No changes to existing business rules or calculations
  • Backward Compatible: Same procedure signatures and behavior
  • Data Integrity: Guarantees unique TabOrder values within parent/portal scope

Impact

  • Minimal Code Changes: Only transaction control additions
  • Database-Level Fix: No application layer modifications required
  • Performance Consideration: SERIALIZABLE isolation may increase latency under high concurrency but is not a concern because the concurrent use of this feature is very limited.

Test Results

Image

Screenshot showing initial database state with proper TabOrder sequencing

Image

Console output showing test execution under sequential conditions

Image

Screenshot showing database maintains proper TabOrder uniqueness after sequential execution

Image

Console output showing test execution under concurrent conditions demonstrating race condition. The other 2 conflicting operations are rejected by the database.

Image

Screenshot showing no duplicate TabOrder values created by concurrent execution

@valadas
Copy link
Copy Markdown
Contributor

valadas commented Jul 29, 2025

10.0.1 is already released though so we need to target 10.0.2 or 10.1.0 (the next release will probably be 10.1.0 as we do have technically features merged in).

@timi-ty
Copy link
Copy Markdown
Contributor Author

timi-ty commented Jul 29, 2025

10.0.1 is already released though so we need to target 10.0.2 or 10.1.0 (the next release will probably be 10.1.0 as we do have technically features merged in).

I updated it to target 10.1.0 instead

Copy link
Copy Markdown
Contributor

@bdukes bdukes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bdukes bdukes added this to the 10.1.0 milestone Jul 29, 2025
@valadas valadas changed the title Fix/move tab proc conc Fix/move tab stored procedures to avoid concurrency issues Jul 29, 2025
Copy link
Copy Markdown
Contributor

@valadas valadas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@valadas valadas merged commit f434c48 into dnnsoftware:develop Jul 29, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants