Commit Graph

20 Commits

Author SHA1 Message Date
Akshay Joshi
7144db7f5a Cleanup session files periodically. Fixes #3674 2018-10-09 11:34:13 +01:00
Harshal Dhumal
013ad7446f Make the session thread safe.
As sessions in pgAdmin4 are filesystem based session, they need locking
for avoiding the access from multiple threads, specially running as an
WSGI application.

Fixes #3547
2018-08-22 11:58:27 +05:30
Aditya Toshniwal
82d77c4608 Don't create a session when the /misc/ping test endpoint is called. Fixes #3371 2018-07-05 11:12:03 +01:00
Dave Page
93d44d5643 Revert "Ensure the cookie domain and path are properly set. Fixes #3197"
This reverts commit 9c4edb4a28.

Jenkins really doesn't like this.
2018-03-15 14:54:14 -04:00
Khushboo Vashi
9c4edb4a28 Ensure the cookie domain and path are properly set. Fixes #3197 2018-03-15 13:59:29 -04:00
Harshal Dhumal
e0da9c5a0c Significantly improve connection loss detection and handling in the query tool. Fixes #2815 2018-02-01 14:29:18 +01:00
Murtuza Zabuawala
c3ddb7df38 PEP8 fixes for the utils module. Fixes #3076 2018-01-31 13:58:55 +00:00
Dave Page
89821c0d19 Update copyright notices for 2018. 2018-01-05 10:42:50 +00:00
Harshal Dhumal
f0ad26ba7a Fix for Exception when the server is restarted. Fixes #2713
This issue was caused because we recently added session_write_delay in session.
So session won't be written/updated to disk from memory until specified seconds are elapsed.

However we must forcefully write/update session to disk if user loges in or out irrespective of session_write_delay to keep sessions from memory and disk in sync as user logged in status is kept in session.
2017-09-18 14:39:43 +01:00
Harshal Dhumal
d339d6b816 Do not dump the session data on the disk on every request.
Session object is updated, everytime a request is being served, and
that was forcing the session object dumped on the dist on every request.

On windows, it was causing issues on slower system on startup. Because -
windows file system locks the file, when it is opened by any
application. And, frequent requests on the pgAdmin main UI rendering
was causing issues, because of that.

In order to resolve the issue, we will not write the session data on
disk for every request, but - only after certain delay (in seconds),
from it was last written. It can be configured using the attribute
'PGADMIN_SESSION_DISK_WRITE_DELAY' in the configuration file,
default vaule for the delay is 10.
(i.e. 10 seconds)
2017-07-25 15:52:32 +05:30
Ashesh Vashi
f2fc1ceba8 Resolved quite a few file-system encoding/decoding related cases.
In order to resolve the non-ascii characters in path (in user directory,
storage path, etc) on windows, we have converted the path into the
short-path, so that - we don't need to deal with the encoding issues
(specially with Python 2).

We've resolved majority of the issues with this patch.
We still need couple issues to resolve after this in the same area.

TODO
* Add better support for non-ascii characters in the database name on
  windows with Python 3
* Improve the messages created after the background processes by
  different modules (such as Backup, Restore, Import/Export, etc.),
  which does not show short-paths, and xml representable characters for
  non-ascii characters, when found in the database objects, and the file
  PATH.

Fixes #2174, #1797, #2166, #1940

Initial patch by: Surinder Kumar
Reviewed by: Murtuza Zabuawala
2017-03-07 15:31:03 +05:30
Dave Page
f221194bcc Update copyright notices for 2017. 2017-01-04 13:33:32 +00:00
Ashesh Vashi
2b809523eb [Python 3 Compability] Made changes to make the new server-side session
implementation works with Python 3.
2016-07-11 16:29:06 +05:30
Ashesh Vashi
61698b7b4d Do not use the sqlite for session handling, as the old implementation is
optimized to work from multiple threads. It has too many frequent
transaction from multiple threads, and that tends to result into the
'database is locked' error of sqlite.

With the new implemenation, we're using the caching mechanism, which
keep the data in the memory all the time, and saves it on request
completion, and loads it only for the first time. Also, it will storage
the data using pickle, which will be faster than accessing sqlite.

Fixes #1329
2016-07-08 16:57:46 +05:30
Dave Page
7d0fe669ca Code tidy. 2016-06-21 14:21:06 +01:00
Dave Page
3026b470e9 Optimise Python imports. 2016-06-21 14:12:14 +01:00
Ashesh Vashi
e8b4bb909b Do not honour the session-id, longer than 40 characters, instead create
new session-id in that case.
2016-05-09 00:04:37 +05:30
Khushboo Vashi
970e0c3540 [Python 3] Fixed an issue iterate the keys from the session loaded from
the sqlite.
2016-04-26 16:16:29 +05:30
Murtuza Zabuawala
12a0cb1ba1 [Python 3] Fixed the issue loading the value for the session key from the sqlite. 2016-03-23 12:40:11 +05:30
Ashesh Vashi
3c366fafe7 Server side session management support. 2016-03-22 15:05:43 +00:00