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

okhttp: Removed Annotation SuppressWarnings("GuardedBy") #11620

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

vinodhabib
Copy link
Contributor

@vinodhabib vinodhabib commented Oct 16, 2024

Removed the SuppressWarnings("GuardedBy") Annotation and Code cleanup.

Note : I can see some UT's are failing in RetriableStreamTest to the corresponding changes of RetriableStream(due to circular dependency issues) which still i am working, meanwhile request you to have look into other 3 files which are completed.

Completed Files:
CronetClientTransport
OkHttpClientStream
OkHttpClientTransport

Pending File:
RetriableStream (Due to Circular Dependency of failing UT's which has both retriableStream.start() and retriableStream.cancel() methods)

Fixes #6578

@vinodhabib vinodhabib marked this pull request as draft October 17, 2024 06:21
@vinodhabib vinodhabib changed the title grpc-okhttp: Removed Annotation SuppressWarnings("GuardedBy") okhttp: Removed Annotation SuppressWarnings("GuardedBy") Oct 18, 2024
@vinodhabib vinodhabib marked this pull request as ready for review October 21, 2024 09:54
// TODO(b/145386688): This access should be guarded by 'stream.transportState().lock'; instead
// found: 'this.lock'
stream.transportState().start(streamFactory);
synchronized (lock) {
Copy link
Contributor

Choose a reason for hiding this comment

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

synchronized (lock) already exists at the caller site (newStream method) and should not be necessary to add.

Copy link
Contributor Author

@vinodhabib vinodhabib Oct 29, 2024

Choose a reason for hiding this comment

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

I can see a query raised with Eric as below , hope as of now no action required. please confirm?
#6578 (comment)

FYI, I can also see a note in the issue description as below.
If we can't remove them or if it would make the code worse, we can leave them as-is and close this issue.

stream.transportState().start(streamFactory);
synchronized (lock) {
streams.add(stream);
synchronized (stream.transportState().lock) {
Copy link
Contributor

Choose a reason for hiding this comment

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

stream.transportState().lock is never accessed outside of synchronized(lock) so this change should also not be needed.

Copy link
Contributor Author

@vinodhabib vinodhabib Oct 29, 2024

Choose a reason for hiding this comment

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

I can see a query raised with Eric as below , hope as of now no action required. please confirm?
#6578 (comment)

Copy link
Contributor Author

@vinodhabib vinodhabib Dec 27, 2024

Choose a reason for hiding this comment

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

@shivaspeaks @kannanjgithub I can see Eric replied on last raised query #6578 (comment) as below.

I wasn't suggesting we remove necessary locks. I was suggesting organize the code such that the tooling can verify the locking. stream.transportState().lock is the same object as this.lock, but ErrorProne isn't able to figure that out because it requires data flow analysis.

I have made similar changes in current PR. Kindly suggest how to proceed further on the same.

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.

Try to remove SuppressWarnings("GuardedBy")
2 participants