Node level Declare Page running for multiple users
There is a node level declare (data) page that expires every 24 hours. It loads approximately 2500 rows of data from a mainframe service call and takes approximately 1-2 minutes to complete. In Pega 7.1, the page is being loaded multiple times if more than one user accesses it after expiration during the 1-2 minutes it takes to load. This did not occur in PRPC 6.1.
No error but many users are loading this same node level page which is very expensive.
Steps to Reproduce
Create node level declare page that takes some time to load to completion. Expire / flush the declare page. Have multiple users access the page at the same time.
While loading a node level data page in a thread, one acquires a lock on a processing valve and release the lock after loading. All other thread which tries to load the same page has to wait for the lock held by former(first) thread. After the page is ready, FIRST thread releases the lock and then PUTS this page into the directory. The put operation occurs outside the lock window. Since the lock is free now, any thread can take it and start the loading the same page, if it is already NOT PRESENT in directory.
There is a race condition where one thread has finished loading the page and is about to do two things:
1. Release the lock
2. Put the page in directory.
As soon as it release the lock, other thread grabs this lock and try to search the page in directory , it doesn't find any because the PUT operation has been completed yet by First Thread. So it tries to reload the same page again and succeeds.
HFix-23310 refactor loadDataPage method in ReadOnlyDataPageHandler class to handle required synchronization for node level data pages and helps resolve this issue.
100% found this useful