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

[Spanner] CacheSessionPool::clear() does not work in some situations #5567

Closed
taka-oyama opened this issue Oct 21, 2022 · 4 comments
Closed
Assignees
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.

Comments

@taka-oyama
Copy link
Contributor

taka-oyama commented Oct 21, 2022

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

  • OS: Alpine Linux 3.16
  • PHP version: 8.0.20
  • Package name and version: google/cloud-spanner v1.53.0

Steps to reproduce

  1. git checkout [email protected]:taka-oyama/google-cloud-php-test.git
  2. git checkout test/spanner-session-clear
  3. Rename .env.sample to .env and configure it to match your setup.
  4. Run docker-compose build && docker-compose run app -> this will start a bash session inside the container.
  5. Run php session_create.php to create the sessions.
  6. Confirm session by running php session_check.php
  7. Attempt to clear session by running php session_clear.php
  8. Confirm that session is not cleared by doing step 5 again.
  9. Open session_clear.php and uncomment the last line.
  10. Repeat steps 7 and 8 to confirm that session is cleared.

I assume this is happening because of the code below.

$this->deleteCalls[] = $this->database->connection()
->deleteSessionAsync([
'name' => $session['name'],
'database' => $this->database->name()
]);

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.

@vishwarajanand
Copy link
Contributor

Hi @taka-oyama thanks for raising this issue so I cannot find taka-oyama/google-cloud-php-test nor the scripts session_[create|check|clear].php.

I need inputs to repro this behavior.

@vishwarajanand vishwarajanand added the api: spanner Issues related to the Spanner API. label Dec 27, 2022
@vishwarajanand vishwarajanand added the type: question Request for information or clarification. Not an issue. label Dec 27, 2022
@taka-oyama
Copy link
Contributor Author

Sorry, I had the repo set to private.
I changed it to public so it should be visible now.

@vishwarajanand
Copy link
Contributor

Thanks for making the repro scripts public, they were helpful for my testing. Fix underway.

@vishwarajanand vishwarajanand added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Mar 17, 2023
@vishwarajanand
Copy link
Contributor

Now, this should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
3 participants