[Spanner] CacheSessionPool::clear() does not work in some situations #5567
Labels
api: spanner
Issues related to the Spanner API.
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: question
Request for information or clarification. Not an issue.
We noticed that running
Google\Cloud\Spanner\Session\CacheSessionPool::clear()
does not work if the process terminates right after calling the method.I have prepared a sample code to replicate the issue.
Environment details
Steps to reproduce
git checkout [email protected]:taka-oyama/google-cloud-php-test.git
git checkout test/spanner-session-clear
.env.sample
to.env
and configure it to match your setup.docker-compose build && docker-compose run app
-> this will start a bash session inside the container.php session_create.php
to create the sessions.php session_check.php
php session_clear.php
session_clear.php
and uncomment the last line.I assume this is happening because of the code below.
google-cloud-php/Spanner/src/Session/CacheSessionPool.php
Lines 821 to 825 in e8e67bd
It's deleting the session asynchronously but doesn't actually wait for it to end which is probably getting cancelled when the script reaches the end.
The text was updated successfully, but these errors were encountered: