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

Binder: address race condition where a new transport may attempt to s… #11253

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ public String toString() {

@Override
public synchronized boolean handleTransaction(int code, Parcel parcel) {
// It's possible that a transaction had started mid-server shutdown. In that case, should not
Copy link
Member

Choose a reason for hiding this comment

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

How about:

// After reporting ServerListener#serverShutdown() above, the InternalServer API contract forbids us from creating any new ServerTransports. But any incoming SETUP_TRANSPORT transactions that were already in-flight before shutdown are still going to arrive here. We must not accept them and the easiest thing is just to ignore.

// proceed with the transport creation since classes like ActiveTransportListener are not
// expecting new transports.
if (shutdown) {
return false;
}

if (code == BinderTransport.SETUP_TRANSPORT) {
int version = parcel.readInt();
// If the client-provided version is more recent, we accept the connection,
Expand Down
Loading