As title says, sessions just keep growing in the database. It has to be deleted manually, or GC has to be triggered by logging in and out.
MariaDB [db]> select expiration from xx_sessions limit 10;
+---------------------+
| expiration |
+---------------------+
| 2016-07-17 02:06:19 |
| 2016-07-17 02:28:21 |
| 2016-07-17 01:23:06 |
| 2016-07-17 02:05:04 |
| 2016-07-17 02:02:04 |
| 2016-07-17 01:47:05 |
| 2016-07-17 01:53:04 |
| 2016-07-17 02:20:05 |
| 2016-07-17 02:14:06 |
| 2016-07-17 01:41:11 |
+---------------------+
10 rows in set (0.00 sec)
MariaDB [db]> select count(*) as t from xx_sessions;
+-------+
| t |
+-------+
| 21915 |
+-------+
1 row in set (0.00 sec)
include/functions_sessions.inc.php handles GC:
functionpwg_session_gc(){global$conf;$query='
DELETE
FROM '.SESSIONS_TABLE.'
WHERE '.pwg_db_date_to_ts('NOW()').' - '.pwg_db_date_to_ts('expiration').' > '.$conf['session_length'].'
;';pwg_query($query);returntrue;}
There is no local override of $conf['session_length'] = 3600;
GC is called from pwg_login when actually logging in. So if a single user stays logged in forever, there is no expiration.
In practical terms, this means that a small and rarely visited gallery will have a sessions table of 50 MB within two weeks. For more active galleries, this will wreak havoc where resources are limited, for example in shared environments.
This is new behavior for Piwigo, it was not like this before. GC should be done periodically by route of some common user interaction.
As title says, sessions just keep growing in the database. It has to be deleted manually, or GC has to be triggered by logging in and out.
```
MariaDB [db]> select expiration from xx_sessions limit 10;
+---------------------+
| expiration |
+---------------------+
| 2016-07-17 02:06:19 |
| 2016-07-17 02:28:21 |
| 2016-07-17 01:23:06 |
| 2016-07-17 02:05:04 |
| 2016-07-17 02:02:04 |
| 2016-07-17 01:47:05 |
| 2016-07-17 01:53:04 |
| 2016-07-17 02:20:05 |
| 2016-07-17 02:14:06 |
| 2016-07-17 01:41:11 |
+---------------------+
10 rows in set (0.00 sec)
MariaDB [db]> select count(*) as t from xx_sessions;
+-------+
| t |
+-------+
| 21915 |
+-------+
1 row in set (0.00 sec)
```
include/functions_sessions.inc.php handles GC:
``` php
function pwg_session_gc()
{
global $conf;
$query = '
DELETE
FROM '.SESSIONS_TABLE.'
WHERE '.pwg_db_date_to_ts('NOW()').' - '.pwg_db_date_to_ts('expiration').' > '
.$conf['session_length'].'
;';
pwg_query($query);
return true;
}
```
There is no local override of `$conf['session_length'] = 3600;`
GC is called from `pwg_login` when actually logging in. So if a single user stays logged in forever, there is no expiration.
In practical terms, this means that a small and rarely visited gallery will have a sessions table of 50 MB within two weeks. For more active galleries, this will wreak havoc where resources are limited, for example in shared environments.
This is new behavior for Piwigo, it was not like this before. GC should be done periodically by route of some common user interaction.
<!-- github-sync-id:168502955 -->
So @zuiguniang confirms that on Debian-like systems, the garbage collector is never triggered. We only rely on the pwg_login execution to purge sessions. I agree it is not perfect and we can't ask all Debian-like users to change their session.gc_probability. But read http://piwigo.org/forum/viewtopic.php?id=23727
Maybe we should include ini_set("session.gc_probability", 1) somewhere.
So @zuiguniang confirms that on Debian-like systems, the garbage collector is never triggered. We only rely on the pwg_login execution to purge sessions. I agree it is not perfect and we can't ask all Debian-like users to change their session.gc_probability. But read http://piwigo.org/forum/viewtopic.php?id=23727
Maybe we should include `ini_set("session.gc_probability", 1)` somewhere.
<!-- github-comment-id:238610125 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
As title says, sessions just keep growing in the database. It has to be deleted manually, or GC has to be triggered by logging in and out.
include/functions_sessions.inc.php handles GC:
There is no local override of
$conf['session_length'] = 3600;GC is called from
pwg_loginwhen actually logging in. So if a single user stays logged in forever, there is no expiration.In practical terms, this means that a small and rarely visited gallery will have a sessions table of 50 MB within two weeks. For more active galleries, this will wreak havoc where resources are limited, for example in shared environments.
This is new behavior for Piwigo, it was not like this before. GC should be done periodically by route of some common user interaction.
Can you look at your php config? The session.gc_probability and session.gc_divisor params
They default to 0 and 1400 on Ubuntu systems. GC is instead done via script /usr/lib/php/sessionclean
So @zuiguniang confirms that on Debian-like systems, the garbage collector is never triggered. We only rely on the pwg_login execution to purge sessions. I agree it is not perfect and we can't ask all Debian-like users to change their session.gc_probability. But read http://piwigo.org/forum/viewtopic.php?id=23727
Maybe we should include
ini_set("session.gc_probability", 1)somewhere.