I was working on the css for my custom theme today on localhost. I refreshed my page to see the results of my edits and got this, rather unexpected, error:

Fatal error: Class Drupal\Core\Session\SessionHandler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read) in H:\srv\dcfwebroot\core\lib\Drupal\Core\Session\SessionHandler.php on line 20

I checked my git-diff and from the point before the error happened to the time that it did the only files that were modified were .scss and .css files within my theme. I tried restoring my database to a backup, no luck. I tried restoring my working tree to head (via git stash), no luck. Finally I tried restarting apache. This fixed the issue (at least for now).

I'm running XAMPP on Windows with Apache 2.4.18 and PHP 7.0.4. Currently I have no idea how to replicate the error unfortunately, but thought it would be best to alert people to it's happening.

Comments

whiplashomega created an issue. See original summary.

dom.’s picture

Version: 8.0.6 » 8.1.1

Same error here. It really seems to have happen randomly while browsing my website.
The only way to get it working back is by restarting my server, which would not be possible on a mutualized prod environment.

ml1’s picture

I'm seeing similar errors:

Fatal error: Class Drupal\\Core\\Session\\SessionHandler contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::open, SessionHandlerInterface::read) in D:\\Apache24\\html\\core\\lib\\Drupal\\Core\\Session\\SessionHandler.php on line 15

Running Apache 2.4.18 from apachelounge and PHP 7.0.7.

As the original report states it seems to occur randomly.

Anonymous’s picture

absolutely identical situation for me with drupal 8.2:

Fatal error: Class Drupal\Core\Session\SessionHandler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::write) in PATH/TO/drupal.site/core/lib/Drupal/Core/Session/SessionHandler.php on line 15

Call Stack
#	Time	Memory	Function	Location
1	0.2011	353624	{main}( )	...\index.php:0
2	0.2027	458984	Drupal\Core\DrupalKernel->handle( )	...\index.php:19
3	0.2247	1614984	Stack\StackedHttpKernel->handle( )	...\DrupalKernel.php:652
4	0.2247	1614984	Drupal\Core\StackMiddleware\NegotiationMiddleware->handle( )	...\StackedHttpKernel.php:23
5	0.2247	1614984	Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle( )	...\NegotiationMiddleware.php:50
6	0.2247	1614984	Drupal\page_cache\StackMiddleware\PageCache->handle( )	...\ReverseProxyMiddleware.php:47
7	0.2253	1617664	Drupal\page_cache\StackMiddleware\PageCache->pass( )	...\PageCache.php:78
8	0.2253	1617664	Drupal\Core\StackMiddleware\KernelPreHandle->handle( )	...\PageCache.php:99
9	0.2365	2168200	Drupal\Core\StackMiddleware\Session->handle( )	...\KernelPreHandle.php:47
10	0.2366	2168200	Drupal\Component\DependencyInjection\Container->get( )	...\Session.php:52
11	0.2366	2173240	Drupal\Component\DependencyInjection\Container->createService( )	...\Container.php:177
12	0.2366	2173240	Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters( )	...\Container.php:236
13	0.2366	2173240	Drupal\Component\DependencyInjection\Container->get( )	...\Container.php:494
14	0.2366	2180584	Drupal\Component\DependencyInjection\Container->createService( )	...\Container.php:177
15	0.2366	2180584	Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters( )	...\Container.php:236
16	0.2371	2187096	Drupal\Component\DependencyInjection\Container->get( )	...\Container.php:494
17	0.2371	2189712	Drupal\Component\DependencyInjection\Container->createService( )	...\Container.php:177
18	0.2371	2189712	Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters( )	...\Container.php:236
19	0.2372	2189712	Drupal\Component\DependencyInjection\Container->get( )	...\Container.php:494
20	0.2372	2192352	Drupal\Component\DependencyInjection\Container->createService( )	...\Container.php:177
21	0.2372	2192352	Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters( )	...\Container.php:236
22	0.2372	2192352	Drupal\Component\DependencyInjection\Container->get( )	...\Container.php:494
23	0.2372	2195520	Drupal\Component\DependencyInjection\Container->createService( )	...\Container.php:177
24	0.2372	2195960	spl_autoload_call ( )	...\Container.php:272
25	0.2372	2196104	Composer\Autoload\ClassLoader->loadClass( )	...\Container.php:272
26	0.2373	2196264	Composer\Autoload\includeFile( )	...\ClassLoader.php:301
27	0.2373	2205376	include( 'PATH/TO/drupal.site/core/lib/Drupal/Core/Session/SessionHandler.php' )	...\ClassLoader.php:412

Maybe problem multiple definitions exist for class SessionHandlerInterface?

Anonymous’s picture

Version: 8.1.1 » 8.2.x-dev
Status: Active » Needs work

Perhaps it occurs after "Fatal error: Allowed memory size". But I could not reproduce it again.

marassa’s picture

Getting this one too. Not 100% sure but I think it happens when I open another session from another browser/device in the same network/same IP address as an already active session.

Fatal error: Class Drupal\Core\Session\SessionHandler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::open) in C:\xampp\apps\drupal\htdocs\core\lib\Drupal\Core\Session\SessionHandler.php on line 15

Running XAMPP on Windows with Apache 2.4.23, PHP 7, Drupal 8.2.3.

Anonymous’s picture

Hmmm.. after your post I wanted to try to get this bug again. I opened several browsers and began to run the compilation scss file and refresh page, and flush caches (although caching has been set in null). Very quickly (3-5 minutes later) I got an error:

Additional uncaught exception thrown while handling exception.

( ! ) Fatal error: Uncaught Error: Class 'Drupal\Core\Utility\Error' not found in PATH\TO\WINDOWS\SITE\core\includes\bootstrap.inc on line 593
( ! ) Error: Class 'Drupal\Core\Utility\Error' not found in PATH\TO\WINDOWS\SITE\core\includes\bootstrap.inc on line 593
Call Stack
#	Time	Memory	Function	Location
1	14.1730	26267928	_drupal_exception_handler( )	...\bootstrap.inc:0
2	14.1731	26270936	_drupal_exception_handler_additional( )	...\bootstrap.inc:571

after refresh page error bit change:

( ! ) Fatal error: Uncaught Error: Class 'Drupal\Core\Config\DatabaseStorage' not found in PATH\TO\WINDOWS\SITE\core\lib\Drupal\Component\DependencyInjection\Container.php on line 272
( ! ) Error: Class 'Drupal\Core\Config\DatabaseStorage' not found in PATH\TO\WINDOWS\SITE\core\lib\Drupal\Component\DependencyInjection\Container.php on line 272
Call Stack
#	Time	Memory	Function	Location
1	0.4739	2161040	_drupal_exception_handler( )	...\bootstrap.inc:0
2	0.4745	2164048	_drupal_exception_handler_additional( )	...\bootstrap.inc:571
3	0.4745	2164048	error_displayable( )	...\bootstrap.inc:591
4	0.4746	2164048	_drupal_get_error_level( )	...\errors.inc:105
5	0.4746	2164048	Drupal::config( )	...\errors.inc:316
6	0.4746	2164048	Drupal\Component\DependencyInjection\Container->get( )	...\Drupal.php:342
7	0.4746	2170176	Drupal\Component\DependencyInjection\Container->createService( )	...\Container.php:177
8	0.4747	2170176	Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters( )	...\Container.php:236
9	0.4747	2170176	Drupal\Component\DependencyInjection\Container->get( )	...\Container.php:494
10	0.4747	2175544	Drupal\Component\DependencyInjection\Container->createService( )	...\Container.php:177
11	0.4747	2175544	Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters( )	...\Container.php:236
12	0.4747	2175544	Drupal\Component\DependencyInjection\Container->createService( )	...\Container.php:509

The error persists after the refresh page, and attempts to open the other pages of the site in other browsers. After restarting the server, the error gone.
I spent a whole hour trying to repeat it, but no results. Although it seemed to me that I just started to compile the wrong scss file and flush cache (or refresh page).

johnnny83’s picture

I got the same error after upgrading xampp from PHP 5.6.19 to 7.0.13

Fatal error: Class Drupal\Core\Session\SessionHandler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read) in C:\Users\********\web\core\lib\Drupal\Core\Session\SessionHandler.php on line 15

marassa’s picture

I stopped getting that error once I moved from XAMPP to hosted environment (linux).

johnnny83’s picture

And now I got the second error of #7

Anonymous’s picture

Excellent! But I could not get this error switching between the 5.6 and 7. Can you describe more about your configuration? Maybe attach error logs.

johnnny83’s picture

PHP Fatal error:  Uncaught Error: Class 'Drupal\\Core\\Config\\DatabaseStorage' not found in C:\\Users\\***\\core\\lib\\Drupal\\Component\\DependencyInjection\\Container.php:272
Stack trace:
#0 C:\\Users\\***\\core\\lib\\Drupal\\Component\\DependencyInjection\\Container.php(509): Drupal\\Component\\DependencyInjection\\Container->createService(Array, 'private__757b70...')
#1 C:\\Users\\***\\core\\lib\\Drupal\\Component\\DependencyInjection\\Container.php(236): Drupal\\Component\\DependencyInjection\\Container->resolveServicesAndParameters(Array)
#2 C:\\Users\\***\\core\\lib\\Drupal\\Component\\DependencyInjection\\Container.php(177): Drupal\\Component\\DependencyInjection\\Container->createService(Array, 'config.storage')
#3 C:\\Users\\***\\core\\lib\\Drupal\\Component\\DependencyInjection\\Container.php(494): Drupal\\Component\\DependencyInjection\\Container->get('config.storage', 1)
#4 C:\\Users\\***\\core\\lib\\Drupal\\Component\\DependencyInjection\\Conta in C:\\Users\\***\\core\\lib\\Drupal\\Component\\DependencyInjection\\Container.php on line 272, referer: https://localhost/***
johnnny83’s picture

Two new observations:
1) After turning off opcache the "DatabaseStorage" error doesn't appear anymore
2) When the "abstract method" error occurs, it does on all Drupal installations on my localhost environment at the same time

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mobil_maniak’s picture

Same issue,
1) After turning off opcache in php.ini. error doesn't appear anymore
2) updated d 8.2.2 to 8.2.6
3) after turning on opcache drupal works without errors/warnings

EDIT: 1 day after
Without any change in settings/modules/xampp error pops out:

Fatal error: Class Drupal\Core\Session\SessionHandler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::open) in C:\xampp\htdocs\test\core\lib\Drupal\Core\Session\SessionHandler.php on line 15
by the way: Error Log is empty.

I tried Flush all cashes and error disappeared.

johnnny83’s picture

I tried Flush all cashes and error disappeared.

Interesting, for me only restarting Apache works...

codeitwisely’s picture

Same as Johnny83 in #16, restarting apache worked!

saranya ashokkumar’s picture

After Restarting Apache that issue fixed for me!

gogowitsch’s picture

For me, this is happening on Drupal 8.2.3 and PHP 7.1.2 from XAMPP. This is not a Drupal-specific error, as other ecosystems see the Apache restart as a remedy, too: 1, 2, 3, 4, 5, 6, 7

kalidasan’s picture

Started working after restarting Apache :)

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mariami.ta’s picture

For me also after restarting Apache error is gone!

ravinderreddyg7’s picture

Restarting Apache fixed the issue.

theicydeveloper’s picture

After restarting Apache on Xampp this issue is gone.
I encounter this issue when adding image and clicking preview.

h.munster’s picture

Restarting Xampp worked for me as well.

theicydeveloper’s picture

I get this error sometimes. My custom modules does call some external REST API and send back a Symfony Response object. Most of the times requests go through but sometimes i get "Fatal error: Class Drupal\Core\Session\SessionHandler" error.
Any one knows any relation of this error with Symfony API?

Anonymous’s picture

My main guess is that this is an Apache problem with limit of computer resource. I received this error twice:

  • #4: when the compilation SCSS to CSS + other background processes.
  • #7: #4 + enhanced testing page through many browsers.

Both cases were on a not very powerful Windows machine (unfortunately, I do not remember the version of Apache).

I have never been able to reproduce this on a more powerful machine with a large amount of resources (both under Windows and under Ubuntu).

In other words, this is not Drupal problem (otherwise it means, that Drupal can full disable the server). However, this very useful issue as support documentation, because it helps to quickly understand what needs to be done - restart Apache.


#26: if this error does not lead to the need to restart Apache, then this is another error, not related to this issue, albeit with a similar name.
ravimalviya2000’s picture

Same error here. It really seems to have happen randomly while browsing my website.
The only way to get it working back is by restarting my server, which would not be possible on fix this error.

hassengh’s picture

affect to memory limit 254M ( memory_limit = 254M )
it is worked for me

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Tzu-Chi Huang’s picture

I have the similar errors too. (Drupal 8.4.4)

Fatal error: Class Drupal\Core\Session\SessionHandler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read) in C:\Apache24\htdocs\core\lib\Drupal\Core\Session\SessionHandler.php on line 15

Current my workaround: Disable "Page cache maximum age" by setting it

gzveri’s picture

Drupal 8.4.4 + XAMP, when trying to uninstall a module got the same error :

Fatal error: Class Drupal\Core\Session\SessionHandler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::open) in C:\mysites\htdocs\d8afsc\core\lib\Drupal\Core\Session\SessionHandler.php on line 15

After restarting XAMP apache and mysql, the site worked fine and I was able to uninstall the module.

gogowitsch’s picture

Status: Needs work » Closed (won't fix)

I am convinced this is a bug in either PHP or Apache binaries. It cannot be solved within Drupal.

dhaval_panara’s picture

I found same kind of error and issue resolved after restarting my server but this is problematic while working on prod environment. Is there any proper solution rather than restart the server?

rbrownell’s picture

For me, disabling OPcache and restarting Apache worked but stopped working within an hour or so on a server that was being shared by multiple developers developing several different Drupal websites. We also made sure that PHP on this development server had access to plenty ram 3GB to be exact. This is also a CentOS 7 server running PHP 7.1 and Apache 2.4.

What ultimately worked for us was modify the OPcache settings... Here is what I changed:

  • opcache.memory_consumption (increased from 128 to 256)
  • opcache.interned_strings_buffer (increased from 8 to 16)
  • opcache.max_accelerated_files (increased from 4000 to 8000)

Ultimately, I think the last one item is what did it for us. Drupal 8 has roughly 30,000 files in core alone, if PHP is only able to cache 4000 of those, there could be issues with dependencies being available at runtime.