Permissions Rebuild fails
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.