title: Debian program ends early (systemd-logind: Removed session)
body: <p>I have a remote debian-jessie server and I sometimes run my programs on it using sftp-client WinSCP through its command line tool.
  My program sends a bulk of http requests to get api responses from another site. It takes about 2-3 hours to do the whole process. It was alright earlier, but recently it started to quit unexpectedly at random times without any traces in log files in /var/log/, except strange "session removed" messages like this:</p>
  
  <pre><code>Feb 12 16:34:00 Debian-82-jessie-64-LAMP systemd-logind[570]: Removed session 11360.
  </code></pre>
  
  <p>This happens on the exact same second the program stops writing into its own log file about the progress and quits.
  Also it seems to stop working at jsoncpp related parsing code, which looks like this:</p>
  
  <pre><code>Json::Value root;
  Json::Reader reader;
  bool parsedSuccess = reader.parse(data, root, false);
  if (parsedSuccess)
  {
      for (int j = 0; j &lt; root.size(); j++)
      {
          // looks like the program quits before this loop ends.
          LogLine(root[j].get("user_id", "0").asString());
      }
  }
  </code></pre>
  
  <p>Can this happen if there's no "user_id" field in received json?
  What walkaround can I use, if that's the case of my problem?</p>
  
  <p>I also updated jsoncpp to the latest version, but it didn't help.</p>
  
  <p>Basically I don't know what the cause is: removal of the session or program crash? And I don't understand why I don't see any crash messages in debian logs too :(</p>
  
  <p>Please, help me out</p>