nodes – session_unset disconnects the user when the page is displayed

We have developed an application in Drupal 7 and I am responsible for migrating this form to Drupal 8. I have a question about the behavior of the session that seems to have changed from Drupal 7 to 8.

Our application is a node and each time this node is browsed or refreshed, the session is disabled and restarted (for security purposes).

function fu_preprocess_node__application (& $ vars) {
session_unset ();
if (session_id () == & # 39;) {
ini_set ('session.gc_maxlifetime', & # 39; 28800 & # 39;);
session_start ();

In Drupal 7, if I am logged in as an administrator and I work on the form and I navigate to the application node to view it, all is well. However, in Drupal 8, when I am logged in to Drupal and want to display this page, session_unset () disconnects me and allows me to deny access to contentual / render and history / 23 / read errors.

What should I change so that we can disable the session for the application form without being disconnected as a Drupal user? For the typical user of this form, who does not log in as a drupal user, this is not a problem. But as an administrator working on the form, it's a problem.