bcosca / fatfree

A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!
2.66k stars 446 forks source link

Session in MySQL database - occasional duplicate entry error #1131

Open radioboss opened 6 years ago

radioboss commented 6 years ago

From time to time I see the following error in my error log

Here's the call stack: PDOStatement: Duplicate entry 'fta5qn9umut0re92l17tft9hcc' for key 'PRIMARY' (500: Internal Server Error) [/fatfree/base.php:2219] Base->error() [/fatfree/db/sql.php:235] user_error() [/fatfree/db/sql/mapper.php:439] DB\SQL->exec() [/fatfree/db/cursor.php:245] DB\SQL\Mapper->insert() [/fatfree/db/sql/session.php:95] DB\Cursor->save() [/php/fatfree/base.php:2091] session_commit()

Why this happens and how to fix it?

KOTRET commented 6 years ago

How frequently this issue appears and how many records are in this table? How much visitors does your page have? It could be a race condition, a problem with generating the session id or something other...

radioboss commented 6 years ago

There are 10-20 records usually. It appears to be a bug in F3 as the error is pretty frequent, it happens couple of times every day...