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

Database Error - no such table: sessions #18

Closed
ghost opened this issue Mar 8, 2016 · 7 comments
Closed

Database Error - no such table: sessions #18

ghost opened this issue Mar 8, 2016 · 7 comments

Comments

@ghost
Copy link

ghost commented Mar 8, 2016

I get the following message in the latest release, the master and develop branches

Database Error
SQLSTATE[HY000]: General error: 1 no such table: sessions
Query String

SELECT sessions.data
FROM sessions
WHERE (sessions.id = :id)
ORDER BY sessions.id

Parameters

Array
(
    [:id] => s35i4vcah2s0k64qq3k9buv436
)

Backtrace

    includes/class/Query.php on line 65
    includes/class/SQL.php on line 195
    includes/class/SQL.php on line 232
    includes/class/Session.php on line 38
    includes/helpers.php on line 36
    includes/common.php on line 318
    includes/common.php on line 318

There's no clear pattern, it can be after browsing a few pages or several, but most of the times after login in as admin and opening /admin. Happens on pages that were already visited successfully before too, for logged in and out users. Clearing the cache solves the issue temporarily.

Cache, cookies and sessions were cleared before each fresh installation. Referes were enabled.

@xenocrat
Copy link
Owner

xenocrat commented Mar 8, 2016

I know you stated you've tried with the develop branch, but can you open the file /includes/class/SQL.php and verify this line of code is specifying PDO::ATTR_PERSISTENT => false (the actual line number might be slightly different depending on whether you are in sync with recent commits).

I've been testing SQLite compatibility recently and I discovered that this persistent mode causes errors whenever the schema is modified by a query.

@ghost
Copy link
Author

ghost commented Mar 8, 2016

I deleted all testing instances afterwards, but now I'm now running 3b136e9, in which I can still reproduce the problem. PDO::ATTR_PERSISTENT => false is there.

I forgot to mention that all tests were done using SQLite.

@xenocrat
Copy link
Owner

xenocrat commented Mar 8, 2016

That's an odd one. Clearly the error is being misreported because if the sessions table didn't exist the problem would occur consistently. My hunch is that this error is the result of some other intermittent connection problem PDO is having. Difficult to diagnose unless I can reproduce it. What version of PHP are you using?

@ghost
Copy link
Author

ghost commented Mar 8, 2016

PHP 5.6.17-3
pdo_sqlite 3.10.2
from the Debian stretch repos.

I will see how it goes using MySQL and let you know.


Edit: nothing, couldn't reproduce with MySQL.

@xenocrat
Copy link
Owner

xenocrat commented Mar 8, 2016

Thanks for testing. I'll dedicate some more time to poking SQLite before the next release. Perhaps I can reproduce the problem.

@ghost
Copy link
Author

ghost commented Mar 9, 2016

I think it has to do with the DB path. I ignored the "full path" message and provided only the name because I saw that the DB was created in the root of my project anyway.

Now, if I do pass the full (writable) path, this error is gone.

It seems that 2 different locations are being referenced as the DB path. The right one, which exists and feeds most of the page, and the broken one causing the error. From what I read, SQLite creates a missing database file silently, which would explain the no such table: sessions message.

@xenocrat
Copy link
Owner

xenocrat commented Mar 9, 2016

That's great news. I'm glad to have the mystery solved. ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant