Magento 2 discards all session parameters
<p>I've written a magento controller which stores some filter information inside the customer session.</p>

<p>According to the magento 2 documentation I use dependency injection to let magento generate the session object for me:</p>

<pre><code>/**
 * @var \Magento\Catalog\Model\Session
 */
protected $_filterSession;

/**
 * @param \Magento\Customer\Model\Session $filterSession
 */
public function __construct( \Magento\Customer\Model\Session $filterSession)
{
    $this-&gt;_filterSession = $filterSession;
}
</code></pre>

<p>The injection process is working quite well. I'm able to access the session, store a variable in it and return it on a further invocation.</p>

<p>But magento seems to discard the whole session information from time to time. I cannot exactly identify the moment magento discards the information, it seems kind of random.</p>

<p>Here is the code:</p>

<pre><code>$this-&gt;_filterSession-&gt;setFrequency($frequency);
$frequency = $this-&gt;_filterSession-&gt;getFrequency();
</code></pre>

<p>I tried out different session scopes but the behaviour is the same.</p>

<p>After many attempts I tried to use the PHP-session to store the information, but even this session was discarded from time to time.</p>

<p>I don't know what I'm doing wrong or what could be the reason for this weird behaviour. Does anybody else have a similar problem or an idea whats the reason?</p>

<p>Thanks in advance,
Thomas</p>