Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#2491 closed Bug (fixed)

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

Reported by: Dunedan Owned by:
Priority: critical Milestone: 1.5.1 Piwik 1.5.1
Component: Core Keywords:
Cc: Sensitive: no

Description

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.

Attachments (2)

piwik-error-session.jpg (26.5 KB) - added by sense 3 years ago.
"Unable to start session." Screenshot
piwik-error-session-2.jpg (25.3 KB) - added by sense 3 years ago.
"The requested website id = 1 couldn't be found" Error

Download all attachments as: .zip

Change History (41)

Changed 3 years ago by sense

"Unable to start session." Screenshot

comment:1 Changed 3 years ago by sense

Confirmed, getting the same error, see attached screen

comment:2 Changed 3 years ago by vipsoft (robocoder)

  • Milestone set to 1.5 - Piwik 1.5

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.

comment:3 Changed 3 years ago by vipsoft (robocoder)

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

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

to:

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

comment:4 Changed 3 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from new to closed

(In [4941]) fixes #2491

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

comment:5 Changed 3 years ago by vipsoft (robocoder)

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

comment:6 Changed 3 years ago by Dunedan

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

comment:7 Changed 3 years ago by sense

I am getting the error "The requested website id = 1 couldn't be found" after applying the the patch (http://dev.piwik.org/trac/ticket/2491#comment:3) and #4941

comment:8 Changed 3 years ago by Beaver6813

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).

Changed 3 years ago by sense

"The requested website id = 1 couldn't be found" Error

comment:10 Changed 3 years ago by sense

But until now nothing helped me to solve my issue

comment:11 Changed 3 years ago by matt (mattab)

  • Resolution fixed deleted
  • Status changed from closed to reopened

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?

comment:12 Changed 3 years ago by sense

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

comment:13 Changed 3 years ago by Dunedan

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

comment:14 Changed 3 years ago by vipsoft (robocoder)

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.)

comment:15 Changed 3 years ago by Dunedan

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.

comment:16 Changed 3 years ago by matt (mattab)

There is a proposal fix in: http://dev.piwik.org/trac/ticket/2499#comment:2

To anyone experiencing the issue, would you mind trying the fix proposed in http://dev.piwik.org/trac/ticket/2499#comment:2 ?

comment:17 Changed 3 years ago by ehanuise

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

comment:18 Changed 3 years ago by matt (mattab)

  • Summary changed from Piwik stopped working after update: Fatal error: Exception thrown without a stack frame in Unknown on line 0 to Fatal error: Exception thrown without a stack frame in Unknown on line 0 - Piwik stopped working after update

comment:19 Changed 3 years ago by ts77

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.

comment:20 Changed 3 years ago by peterb (peterbo)

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://dev.piwik.org/trac/attachment/ticket/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.

comment:21 Changed 3 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from reopened to closed

(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

comment:22 Changed 3 years ago by Dunedan

Bug still appears with applied [4950].

comment:23 Changed 3 years ago by vipsoft (robocoder)

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.

comment:24 Changed 3 years ago by Dunedan

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.

comment:25 Changed 3 years ago by vipsoft (robocoder)

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

comment:26 Changed 3 years ago by vipsoft (robocoder)

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

comment:27 Changed 3 years ago by vipsoft (robocoder)

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

comment:28 Changed 3 years ago by vipsoft (robocoder)

(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.

comment:29 Changed 3 years ago by vipsoft (robocoder)

  • Summary changed from Fatal error: Exception thrown without a stack frame in Unknown on line 0 - Piwik stopped working after update to Session SaveHandler DbTable - Fatal error: Exception thrown without a stack frame in Unknown on line 0

comment:30 follow-up: Changed 3 years ago by webslave

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?

comment:31 in reply to: ↑ 30 Changed 3 years ago by peterb (peterbo)

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.

comment:32 Changed 3 years ago by webslave

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-trac@… and piwik-trac-owner@…), apparently without success. To which e-mail address may I send the FTP data?

Thank you in advance for your help!

comment:33 Changed 3 years ago by matt (mattab)

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

comment:34 Changed 3 years ago by Ich007

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

comment:35 Changed 3 years ago by vipsoft (robocoder)

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

comment:36 Changed 3 years ago by webslave

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

comment:37 Changed 3 years ago by Ich007

I got the same message.

comment:38 Changed 3 years ago by matt (mattab)

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

comment:39 Changed 2 years ago by matt (mattab)

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

Note: See TracTickets for help on using tickets.