Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Session SaveHandler DbTable - Fatal error: Exception thrown without a stack frame in Unknown on line 0 #2491

Closed
anonymous-piwik-user opened this Issue · 39 comments

5 participants

Anonymous Piwik user Sven Anthon Pang Matthieu Aubry Peter Boehlke
Anonymous Piwik user

After the Update from Piwik 1.4 to Piwik 1.5 Piwik stopped working. When I try to login I get the message:

Fehler: Form security failed. Please reload the form and check that your cookies are enabled. If you use a proxy server, you must  configure Piwik to accept the proxy header that forwards the Host header. Also, check that your Referer header is sent correctly.

and log fills up with:

Fatal error: Exception thrown without a stack frame in Unknown on line 0

Nothing changed at the setup which has been working before the update.

Sven

Attachment: "Unable to start session." Screenshot
piwik-error-session.jpg

Sven

Confirmed, getting the same error, see attached screen

Anthon Pang
Collaborator

We may need ftp access to your servers to insert debug code into Zend Framework. For 1.5, we actually simplified the Nonce and Session handling code in Piwik.

Anthon Pang
Collaborator

Temporary workaround:
In core/Session.php, change:

if(in_array($currentSaveHandler, array('user', 'mm', 'files')))

to:

if(in_array($currentSaveHandler, array('user', 'mm')))
Anthon Pang
Collaborator

(In [4941]) fixes #2491

  • couldn't reproduce it, but description matches ZF-7611, ZF-7171 - exception thrown
  • also, http://forum.piwik.org/read.php?5,78021 - ini_set disabled
  • quickly sanity tested on 5.1.3, 5.2.0, and 5.3.6

Note to self: there's a ZF1 memcache savehandler in ZF-10561

Anthon Pang
Collaborator

(In [4942]) refs #2491 - partial revert - ini_set is checked in testMinimumPhpVersion.php

Anonymous Piwik user

After applying #4942 the problem still occurs.
On the other hand your previous mentioned workaround is working.

Sven

I am getting the error "The requested website id = 1 couldn't be found" after applying the the patch (#2491) and #4941

Anonymous Piwik user

Didn't realise this bug was already posted. I created a ticket on 2494 (could you please merge).
This is a bug and is recreatable (apparently by more than one person).

Sven

Attachment: "The requested website id = 1 couldn't be found" Error
piwik-error-session-2.jpg

Matthieu Aubry
Owner

Reported by many users in http://forum.piwik.org/read.php?2,78026

Sven

But until now nothing helped me to solve my issue

Matthieu Aubry
Owner

We have not been able to replicate so far. What versions of PHP are you using? can you upgrade to latest PHP and try again?

Sven

Applying all db updates manually finally did the trick and everything now seems to work fine

Anonymous Piwik user

Ok, so I'll start with my setup.
First of all: I've no problem with the database upgrade nor with missing site-id 1. My only problem is the one described in the original post.

My setup is:

  • Debian/squeeze
  • PHP 5.3.3-7+squeeze1 with Suhosin via fastcgi
  • APC as opcode cache
Anthon Pang
Collaborator

Anyone still having a problem must verify that there's a piwik_session table. If not, then the db update did not run, so you'll have to execute the SQL manually. (There's a race condition bug in the 1.4 update process.)

Anonymous Piwik user

For my installation the piwik_session table already exists. So I assume the update went quite well (at least for me). But the problems seem to be independent from the existence of that table.

Matthieu Aubry
Owner

There is a proposal fix in: #2499

To anyone experiencing the issue, would you mind trying the fix proposed in #2499 ?

Anonymous Piwik user

Experienced the problem after 1.4 > 1.5 upgrade, and it was fixed by changing :

if(in_array($currentSaveHandler, array('user', 'mm', 'files')))

to:

if(in_array($currentSaveHandler, array('user', 'mm')))

here are parts of the phpinfo(), in case it can help :)
On another server (debian 5), the upgrade went fine.

PHP Version 5.2.10
Linux I############ 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST 2011 i686
PHP API 20041225
PHP Extension 20060613
Zend Extension 220060519
Configure Command './configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--without-mime-magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' '--disable-json'

Apache Version Apache/2.2.3 (CentOS)
Apache API Version 20051115
Loaded Modules core prefork http_core mod_so mod_auth_basic mod_auth_digest mod_authn_file mod_authn_alias mod_authn_anon mod_authn_dbm mod_authn_default mod_authz_host mod_authz_user mod_authz_owner mod_authz_groupfile mod_authz_dbm mod_authz_default util_ldap mod_authnz_ldap mod_include mod_log_config mod_logio mod_env mod_ext_filter mod_mime_magic mod_expires mod_deflate mod_headers mod_usertrack mod_setenvif mod_mime mod_status mod_autoindex mod_info mod_vhost_alias mod_negotiation mod_dir mod_actions mod_speling mod_userdir mod_alias mod_rewrite mod_proxy mod_proxy_balancer mod_proxy_ftp mod_proxy_http mod_proxy_connect mod_cache mod_suexec mod_disk_cache mod_file_cache mod_mem_cache mod_cgi mod_version mod_php5 mod_proxy_ajp

APC Support enabled
Version 3.1.6

session
Session Support enabled
Registered save handlers files user
Registered serializer handlers php php_binary wddx

Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /var/lib/php/session /var/lib/php/session
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid 0 0

Anonymous Piwik user

Got a report in the german forum (which I can't link here as akismet says that its spam ) that the changes in [4941] weren't enough but comment:3 fixed it.

Peter Boehlke
Collaborator

There are 3 cases (that I know) which can rise this weird "Exception thrown without a stack frame in Unknown on line 0" error:
1) an uncaught exception is thrown in the constructor or destructor of a class
2) something goes wrong while autoloading a class
3) - and I suppose, this is the case here, the customized Error- / Exception-Handler throws an unexpected Error / Exception by itself.

Since the ExceptionHandler is fully wrapped into try/catch, the ErrorHandler must be the problem here. We've fixed an potential error in #2499 (http://issues.piwik.org/attachments/2499/Refs_%232499.patch) that raises the "nesting level" error which could, in some cases, also produce the confusing error.
Ways to figure that out: Disable the custom Piwik Error/Exception Handler in index.php. Perhaps we well hopefully see the original error / exception then and can fix the issue with the error handler as well.

Anthon Pang
Collaborator

(In [4950]) fixes #2491 - still can't reproduce (tested with/without Suhosin, across multiple PHP versions); calling Zend_Session::writeClose() multiple times is handled by Zend/Session.php

Anonymous Piwik user

Bug still appears with applied [4950].

Anthon Pang
Collaborator

Dunedan: Please also apply [4949], try disabling APC and restarting the php fastcgi process. If you continue to have a problem, send us an email with host+ftp (or ssh) login/password, so we can take a look at your environment.

Anonymous Piwik user

The bug still appears after applying [4949], disabling APC and restarting the fastcgi processes.
I think I'll stick with the workaround from comment 3 for now.

Anthon Pang
Collaborator

Using the 'files' session.save_handler is now unsupported for the reasons given in #1279.

Upgrading to 5.3.4 or later should fix the problem for users who have the trunk patches, yet are still affected. There is a PHP build bug that depends on the extensions that are enabled at compile-time, which can cause session close + autoload to fail in in 5.2.x and 5.3.x. See bugs.php.net/bug.php?id=53141

Anthon Pang
Collaborator

(In [4958]) refs #2491 - see ZF-11521

Anthon Pang
Collaborator

(In [4969]) refs #2491 - replace Zend_Session_SaveHandler_DbTable with a leaner and cleaner implementation

Anthon Pang
Collaborator

(In [4970]) refs #2491 - fix typo

The new savehandler uses the DB adapters that have already been well-tested in Piwik, instead of using Zend_DB_Table (as Zend_Db_Adapter_Mysqli isn't as well-supported as the PDO adapters in ZF).

Note: there's a MySQL-ism which we can address later in #1368.

Anonymous Piwik user

Same probs as mentioned above. Now tried with 1.5.1, but I am getting as well "Fatal error: Exception thrown without a stack frame in Unknown on line 0" when opening piwik after update (same as for 1.5). I tried with several patches, but I get same results as mentioned.

I am using PHP 5.2.17 and I am not able to upgrade version (using a server of 1und1).

Now downgraded piwik to 1.4 again, which is working fine - which should not be the final solution I hope. Is there any possibility to use 1.5 and further updates with PHP 5.2?

Peter Boehlke
Collaborator

Replying to webslave:

This is not specifically related to PHP 5.2.x versions. Maybe you can provide FTP / Piwik credentials to us so we can investigate the issue. I have not been able to reproduce this on any machine, and I don't know either if Anthon was able to reproduce.

Anonymous Piwik user

I tried again to update, still getting the same error message. Could you please have a look?

Tried to send you my FTP & Piwik credentials by e-mail (to trac@piwik.org, piwik-trac@piwik.org and piwik-trac-owner@piwik.org), apparently without success. To which e-mail address may I send the FTP data?

Thank you in advance for your help!

Matthieu Aubry
Owner

please send FTP details + bug reminder at matt att piwik thanks!

Anonymous Piwik user

I got the same problem with piwik version 1.5 and 1.5.1. Did someone found a solution??

Anthon Pang
Collaborator

If you're still having a problem, try the latest nightly QA build at http://qa.piwik.org:8080/nightly/

Anonymous Piwik user

I tried the QA build, but I am getting the error "The requested website id = 1 couldn't be found".

Anonymous Piwik user

I got the same message.

Matthieu Aubry
Owner

To everybody who still experiences some issues with this ticket:

  • What version of Piwik are you using?
  • Do you get an error while upgrading to 1.5.1 automatically? try manual FTP upload all 1.5.1 files
  • What is the exact error message and where / when does it display?

Let's nail down the remaining issues that happen in 1.5.1, thank you for your reports

Matthieu Aubry
Owner

See the ticket for the same reason but different causes, in Piwik 1.6 #2717

Anonymous Piwik user anonymous-piwik-user added this to the 1.5.1 Piwik 1.5.1 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.