Closed amercader closed 8 years ago
As stated in the previous line to the one you've remarked, the session.save()
instruction is there because in some cases we are required to use a flash message to inform the user the logging process has failed. The flash message is displayed here: https://github.com/conwetlab/ckanext-oauth2/blob/master/ckanext/oauth2/controller.py#L63.
I cannot remember it very well right now, but I think that line is there because otherwise the flash message did not work (I think I tried different places with no results). Anyway, I will try to fix it as soon as possible...
As you can see, I have moved the session.save()
statement to the place where the session need to be created in order to display the flash message. In this regard, I think no more unnecessary session files will be created by this extension.
PS: I have updated the FIWARE Lab instance with the last version of the plugin :)
Great, thanks @aitormagan
This call here:
https://github.com/conwetlab/ckanext-oauth2/blob/4833c26eb617763d8304635657ceb9748af6125a/ckanext/oauth2/plugin.py#L110
essentially means that a session file is created for every single request that is made to CKAN, which would explain the massive number of session files. This leads to millions and millions of session files being created, which eventually means that the server will run out of inodes, causing the application to crash.
Session files should only be created when needed (eg to display flash messages)