Skip to content

RUM-7543 Allocate rwlock on the heap #2301

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

Merged
merged 2 commits into from
May 20, 2025

Conversation

maxep
Copy link
Member

@maxep maxep commented May 19, 2025

What and why?

Given this exemple:

var rwlock = pthread_rwlock_t()
pthread_rwlock_rdlock(&rwlock)

rwlock is not a real pointer that is long-lasting valid. Instead the lock pointer should be allocated on the heap.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes
  • Add Objective-C interface for public APIs (see our guidelines (internal) and run make api-surface)

@maxep maxep requested review from a team as code owners May 19, 2025 08:26
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented May 19, 2025

Datadog Report

Branch report: maxep/RUM-7543/rwlock-heap-allocation
Commit report: bd1e60e
Test service: dd-sdk-ios

✅ 0 Failed, 51 Passed, 3847 Skipped, 2m 0.35s Total duration (2m 32.45s time saved)

mariedm
mariedm previously approved these changes May 19, 2025
Copy link
Member

@mariedm mariedm left a comment

Choose a reason for hiding this comment

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

Nice find! Thanks for this fix. 🛠️ I wonder how often this lead to unexpected crashes given that we use this lock in many parts of the SDK.

@maxep
Copy link
Member Author

maxep commented May 19, 2025

@mariedm I don't expect it to be much of a problem in its current state since the lock is wrapped within a class, but still it was at risk.

Copy link
Contributor

@simaoseica-dd simaoseica-dd left a comment

Choose a reason for hiding this comment

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

Can you add more tests to the ReadWriteLockTests? For instance, tests that trigger the ReadWriteLock deinit concurrently?

@maxep
Copy link
Member Author

maxep commented May 20, 2025

@simaoseica-dd, the ReadWriteLock is now 100% covered 👍

Copy link
Contributor

@simaoseica-dd simaoseica-dd left a comment

Choose a reason for hiding this comment

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

LGTM

@maxep
Copy link
Member Author

maxep commented May 20, 2025

/merge

@dd-devflow
Copy link

dd-devflow bot commented May 20, 2025

View all feedbacks in Devflow UI.

2025-05-20 11:49:37 UTC ℹ️ Start processing command /merge


2025-05-20 11:49:42 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in develop is approximately 1h (p90).


2025-05-20 12:34:25 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue dd-mergequeue bot merged commit e8734a4 into develop May 20, 2025
15 checks passed
@dd-mergequeue dd-mergequeue bot deleted the maxep/RUM-7543/rwlock-heap-allocation branch May 20, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants