Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should dispatcher always start/resume session? #885

Closed
robocoder opened this issue Jul 28, 2009 · 3 comments
Closed

Should dispatcher always start/resume session? #885

robocoder opened this issue Jul 28, 2009 · 3 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@robocoder
Copy link
Contributor

Prior to #828, index.php contained:

if(!session_id()) {
    session_start();
}

However, session_start() was always called because session_id() returns a string; even an empty string (""), would mean the conditional evaluated to true.

This isn't necessarily wrong as it either starts or resumes an existing session. In fact, it masks a problem where MySQL is configured with a low limit on concurrent connections. By calling session_start() in index.php, requests associated with the same session are funneled in serial fashion.

See comments:

Following #828, the session_start() call was removed. We are starting to see reports of "SQLSTATE![1203 User xxxxxx already has more than 'max_user_connections' active connections" appearing in some dashboard widgets.

Proposed patch:

Index: index.php
===================================================================
--- index.php   (revision 1329)
+++ index.php   (working copy)
@@ -37,6 +37,7 @@
 session_cache_limiter('nocache');
 @date_default_timezone_set(date_default_timezone_get());
 require_once PIWIK_INCLUDE_PATH .'/core/Loader.php';
+Zend_Session::start();

 if(!defined('PIWIK_ENABLE_ERROR_HANDLER') || PIWIK_ENABLE_ERROR_HANDLER)
 {

This duplicates the functionality of "session.auto_start=On" (see #881), but is Zend Framework-friendly.

Pros:

  • Mitigates the connection limit problem.
  • Potentially lowers peak load on the server.

Cons:

  • A long-loading widget delays the loading of other widgets. This gives the appearance that the dashboard is taking longer to load.
@robocoder
Copy link
Contributor Author

(In [1339]) fixes #885 - dispatcher starts/resumes session unless PIWIK_ENABLE_SESSION_START=0

@mattab
Copy link
Member

mattab commented Jul 28, 2009

vipsoft, if I read the comment on the php site, it says that the session_start is blocking all other http requests trying to load concurrently that are also doing session_start, until the session has been committed.

It sounds to me like this would indeed slow down significantly the dashboard, and is probably not a good thing.

Was it the behavior prior to the session changes (for example in 0.2.x ?)

or is the slowness a regression?

@robocoder
Copy link
Contributor Author

[1339] restores the functionality prior to #828.

#886 will give sites with higher mysql max_connections to set PIWIK_ENABLE_SESSION_START=0 and get parallel requests for potentially faster (certainly more responsive in appearance) dashboard loading.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

2 participants