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

fix: ObjectKVStore::put on throwing __set #3066

Closed
wants to merge 1 commit into from

Conversation

PROFeNoM
Copy link
Contributor

@PROFeNoM PROFeNoM commented Feb 3, 2025

Motivation

In predis/predis, starting v2.1.2 w/ predis/predis#1049, it is no longer possible to use ObjectKVStore::put in versions 7.4 and below since Predis\Client::__set will be throwing an exception.

Currently, PredisIntegration is throwing an exception on versions 2.1.2+, using a PHP runtime that is strictly less than 7.4. Current estimates are reporting that ~5% of orgs using the predis integration are impacted.

Description

Fallback to spl_object_hash when it is not possible to use the weakmap nor __set.

This should allow to proceed with #3065.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@PROFeNoM PROFeNoM self-assigned this Feb 3, 2025
@PROFeNoM PROFeNoM marked this pull request as ready for review February 3, 2025 10:05
@PROFeNoM PROFeNoM requested review from a team as code owners February 3, 2025 10:05
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.75%. Comparing base (c11372f) to head (dc021f3).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3066      +/-   ##
============================================
+ Coverage     72.97%   74.75%   +1.78%     
- Complexity     2790     2793       +3     
============================================
  Files           139      112      -27     
  Lines         15273    11047    -4226     
  Branches       1043        0    -1043     
============================================
- Hits          11145     8258    -2887     
+ Misses         3577     2789     -788     
+ Partials        551        0     -551     
Flag Coverage Δ
appsec-extension ?
tracer-php 74.75% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/DDTrace/Util/ObjectKVStore.php 100.00% <100.00%> (ø)

... and 27 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c11372f...dc021f3. Read the comment docs.

Copy link
Collaborator

@bwoebi bwoebi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not do that. This leaks memory and is never cleaned up.
(And throwing+catching an exception is also relatively expensive)
We just need another object to attach our data to, and I think $client->getConnection() is perfectly suited for that.

@PROFeNoM PROFeNoM closed this Feb 4, 2025
@PROFeNoM PROFeNoM deleted the alex/fix/objectkvstore-put-not-allowed-set branch February 4, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants