Better retrieve it through the request instead.
```php
$session = $this->request->getSession()
```