grpc-swift
grpc-swift copied to clipboard
Channel connectivityState crash after shutdown
New Issue Checklist
- [x] Updated grpc-swift to the latest version
- [x] I read the Contribution Guidelines
- [x] I searched for existing GitHub issues(especially, there are many resolved issues related to SSL)
Issue Description
I'm using Swift gRPC on iOS and trying to keep connection when device switches between wifi<>cellular or different cellular technologies as suggested here #337.
So I shutdown active service client channel. And next time I talk to client, I want to check whether it's shutdown or not, so I can decide if I need to create new client or use the current one.
The only way to do it AFAIK is to call its channel's connectivityState
method.
But I get EXC_BAD_ACCESS
when calling it, after channel was shutdown.
I suppose it happens after underlying channel pointer is freed in shutdown
method and I try to access if afterwards in connectivityState
method.
I don't know much about implementation details whether we should keep underlying channel pointer alive so we can keep using it to get its state, or whether we should rely on some secondary knowledge if it was shutdown like hasBeenShutdown
private flag, so I couldn't create PR to fix it.
Environment
Key | Value |
---|---|
OS Version | 10.14.4 |
Swift Version | 4.2 |
Xcode Version | 10.2.1 |
gRPC-Swift Version | 0.9.0 |