Permissions Rebuild fails After I installed a quiz module on my Drupal 7 site, it asked me to rebuild permissions. when I try to rebuild it throws this error:



I've tried everything that I found online, including:


increasing web server RAM
max_execution_time = 1600
max_input_time = 180
max_input_nesting_level = 300
memory_limit = 512M 
disabling batch mode from node.module core file


nothing seems to work.

There are about 600k records in the node table. I know this is a lot, and probably it causes my issue, but what is the workaround? How can I rebuild permissions with this many nodes easily?
Wherever that "Illegal access" Ajax error comes from, I recommend to rebuild node access from the command line instead. With Drush the following command should do it.

$ drush php-eval 'node_access_rebuild();'




With that many (600k) records in your database it may also be better to have that done by some more advanced process like the one provided by the Node Access Rebuild Progressive module. It also provides its own Drush command.

$ drush node-access-rebuild-progressive



  Approach
  
  The module works by processing nodes in chunks, from highest node.nid
  to lowest, until all nodes have been recomputed, storing the last
  processed nid in a variable (d7) / as state (d8). This ensure no nodes
  can be skipped, while avoiding having to populate a Queue or other
  equivalent mechanism, which can be heavy in itself.