PHP Fatal Error after successful upgrade from OJS 3.1.1-0 to 3.2.1-2 [Solved]

Application Version - OJS 3.2.1-2
Description of issue:
PHP Fatal error: Uncaught Exception: DB Error: Duplicate entry ‘cr21phol0093r640p7mj1l0e77’ for key ‘sessions_pkey’ Query: INSERT INTO sessions (session_id, ip_address, user_agent, created, last_used, remember, data, domain) VALUES (?, ?, ?, ?, ?, ?, ?, ?) in /home/user/example.com/lib/pkp/classes/db/DAO.inc.php:703
Steps you took leading up to the issue: Successful upgrade from OJS 3.1.1-0 to 3.2.1-2
What you tried to resolve the issue: None
Screenshots:


Error log messages:
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:53:46 Asia/Kolkata] PHP Notice: Trying to access array offset on value of type null in /home/user/example.com/lib/pkp/lib/vendor/wikimedia/less.php/lib/Less/Parser.php on line 1927
[15-Nov-2020 08:55:35 Asia/Kolkata] WARNING: The NavigationMenu (ContextId: 1, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
[15-Nov-2020 08:55:35 Asia/Kolkata] WARNING: The NavigationMenu (ContextId: 1, Title: Primary Navigation Menu, Area: primary) will be skipped because the specified area has already a NavigationMenu attached.
[15-Nov-2020 08:55:35 Asia/Kolkata] WARNING: The NavigationMenu (ContextId: 0, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
[15-Nov-2020 09:01:54 Asia/Kolkata] PHP Fatal error: Uncaught Exception: DB Error: Duplicate entry ‘cr21phol0093r640p7mj1l0e77’ for key ‘sessions_pkey’ Query: INSERT INTO sessions
(session_id, ip_address, user_agent, created, last_used, remember, data, domain)
VALUES
(?, ?, ?, ?, ?, ?, ?, ?) in /home/user/example.com/lib/pkp/classes/db/DAO.inc.php:703
Stack trace:
#0 /home/user/example.com/lib/pkp/classes/db/DAO.inc.php(231): DAO->handleError()
#1 /home/user/example.com/lib/pkp/classes/session/SessionDAO.inc.php(78): DAO->update()
#2 /home/user/example.com/lib/pkp/classes/session/SessionManager.inc.php(89): SessionDAO->insertObject()
#3 /home/user/example.com/lib/pkp/classes/session/SessionManager.inc.php(129): SessionManager->__construct()
#4 /home/user/example.com/lib/pkp/classes/security/Validation.inc.php(377): SessionManager::getManager()
#5 /home/user/example.com/lib/pkp/classes/core/PKPPageRouter.inc.php(66): Validation::isLoggedIn()
#6 /home/user/example.com/lib/pkp/classes/core/Dispatcher.inc. in /home/user/example.com/lib/pkp/classes/db/DAO.inc.php on line 703
[15-Nov-2020 09:02:08 Asia/Kolkata] PHP Fatal error: Uncaught Exception: DB Error: Duplicate entry ‘cr21phol0093r640p7mj1l0e77’ for key ‘sessions_pkey’ Query: INSERT INTO sessions
(session_id, ip_address, user_agent, created, last_used, remember, data, domain)
VALUES
(?, ?, ?, ?, ?, ?, ?, ?) in /home/user/example.com/lib/pkp/classes/db/DAO.inc.php:703
Stack trace:
#0 /home/user/example.com/lib/pkp/classes/db/DAO.inc.php(231): DAO->handleError()
#1 /home/user/example.com/lib/pkp/classes/session/SessionDAO.inc.php(78): DAO->update()
#2 /home/user/example.com/lib/pkp/classes/session/SessionManager.inc.php(89): SessionDAO->insertObject()
#3 /home/user/example.com/lib/pkp/classes/session/SessionManager.inc.php(129): SessionManager->__construct()
#4 /home/user/example.com/lib/pkp/classes/security/Validation.inc.php(377): SessionManager::getManager()
#5 /home/user/example.com/lib/pkp/classes/core/PKPPageRouter.inc.php(66): Validation::isLoggedIn()
#6 /home/user/example.com/lib/pkp/classes/core/Dispatcher.inc. in /home/user/example.com/lib/pkp/classes/db/DAO.inc.php on line 703
[15-Nov-2020 09:02:57 Asia/Kolkata] PHP Fatal error: Uncaught Exception: DB Error: Duplicate entry ‘cr21phol0093r640p7mj1l0e77’ for key ‘sessions_pkey’ Query: INSERT INTO sessions
(session_id, ip_address, user_agent, created, last_used, remember, data, domain)
VALUES
(?, ?, ?, ?, ?, ?, ?, ?) in /home/user/example.com/lib/pkp/classes/db/DAO.inc.php:703
Stack trace:
#0 /home/user/example.com/lib/pkp/classes/db/DAO.inc.php(231): DAO->handleError()
#1 /home/user/example.com/lib/pkp/classes/session/SessionDAO.inc.php(78): DAO->update()
#2 /home/user/example.com/lib/pkp/classes/session/SessionManager.inc.php(89): SessionDAO->insertObject()
#3 /home/user/example.com/lib/pkp/classes/session/SessionManager.inc.php(129): SessionManager->__construct()
#4 /home/user/example.com/lib/pkp/classes/security/Validation.inc.php(377): SessionManager::getManager()
#5 /home/user/example.com/lib/pkp/classes/core/PKPPageRouter.inc.php(66): Validation::isLoggedIn()
#6 /home/user/example.com/lib/pkp/classes/core/Dispatcher.inc. in /home/user/example.com/lib/pkp/classes/db/DAO.inc.php on line 703


Answer
Could find the issue. It was the php.ini parameters causing it namely
session.save_handler = files
session.save_path =

1 Like

Great that you found the issue, but could you please also include the solution?
I am experiencing exactly the same problem as you.
What should the correct php.ini parameters for session.save_handler and session.save_path?
Best,
Eirik Hanssen

Dear Eirik Hanssen
If you are running your OJS on a shared server hosting, you shall not have control over php.ini file setting. OJS enforces dB based session log as mentioned in DB Error: Duplicate entry 'xxxxxx' for key 'sessions_pkey'. For further insight see this post DB Error: Duplicate entry 'xxxxxx' for key 'sessions_pkey'. You can output phpinfo() and see the settings. you can override the php.ini settings by using user.ini or .htaccess file. In user.ini file i have commented out the below parameters so that OJS overrides the php.ini setting for logging sessions.

;session.save_handler
;session.save_path =

Hope it answers your question.