Archiving messes with sessions?


(kaspar) #1

I made the observation that our Server hast plenty of sessionfiles that seems to be related to the arcivingscript you provide in you faq-section.
Every day at 5 am (the time we run the cronjob) 3 sessionfiles are generated (i assume for day week year) and not deleted. Could it be that the script opens a session and doesn’t close it correctly?


(vipsoft) #2

Session files are cleaned up by php periodically. See php.ini.


(kaspar) #3

well… thanks… every other sessionfiles are deleted by the garbage collection, the ones generated by piwik are the only ones that doesn’t. That’s why I posted it here. Otherwise I’d call that a problem of our settings but because of this fact I’m not that sure about this.


(vipsoft) #4

Check your php.ini. php-cli may be using a different configuration file where garbage collection is disabled, has a lower probability of running, or has a longer lifetime.

Otherwise, this sounds like a php bug. A workaround would be to modify archive.sh to use a custom session save path, and then delete those session files afterwards, e.g., (snippets below)

SAVE_PATH=/tmp/piwik.archive.sessions
...
  CMD="$PHP_BIN -d session.save_path=$SAVE_PATH $PIWIK_PATH -- module=API&method=VisitsSummary.getVisits&idSite=all&period=$period&date=last52&format=xml&token_auth=$TOKEN_AUTH";
...
rm -f $SAVE_PATH/*