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

Cannot subscribe again when server closed subscribtion #218

Open
de-wu opened this issue Apr 25, 2021 · 2 comments
Open

Cannot subscribe again when server closed subscribtion #218

de-wu opened this issue Apr 25, 2021 · 2 comments
Assignees
Labels
bug Something isn't working grpc QtGrpc related issues
Projects
Milestone

Comments

@de-wu
Copy link

de-wu commented Apr 25, 2021

Describe the bug
When the server closes the subscription, the client cannot create a new one. The previously terminated subscription is returned.
I found line, which produce this problem:

QGrpcHttp2Channel.cpp in subscribe function and finishconnection slot:

switch (networkError) {
case QNetworkReply::RemoteHostClosedError:
qProtoDebug() << "Remote server closed connection. Reconnect silently";
subscribe(subscription, service, client);
break;
case QNetworkReply::NoError:
//Reply closed without error
break;
default:
subscription->error(QGrpcStatus{StatusCodeMap.at(networkError), QString("%1 call %2 subscription failed: %3").arg(service).arg(subscription->method()).arg(errorString)});
break;

replace with:

switch (networkError) {
case QNetworkReply::RemoteHostClosedError:
qProtoDebug() << "Remote server closed connection. Reconnect silently";
subscribe(subscription, service, client);
break;
case QNetworkReply::NoError:
//Reply closed without error
subscription->finished();
break;
default:
subscription->error(QGrpcStatus{StatusCodeMap.at(networkError), QString("%1 call %2 subscription failed: %3").arg(service).arg(subscription->method()).arg(errorString)});
break;

@de-wu de-wu added the bug Something isn't working label Apr 25, 2021
@semlanik
Copy link
Owner

semlanik commented Apr 25, 2021

Hi @de-wu that's strange that you get NoError when server closes subscription, it should be case above the line you're pointing to. But the problem with subscription is in place. It's not cleaned up and due to the mechanism that prevents duplicating of a subscription, you're not able to get a new one.

@de-wu
Copy link
Author

de-wu commented Apr 26, 2021

I tested this on localhost in Ubuntu 20.04, maybe localhost was the problem. I will check it between hosts in network, because this solution may be problematic in other cases, but when I made this changes it's look correct.

@semlanik semlanik added this to the v0.7.0 milestone Jun 1, 2021
@semlanik semlanik added this to ToDo in Qt Protobuf via automation Jun 1, 2021
@semlanik semlanik added the grpc QtGrpc related issues label Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working grpc QtGrpc related issues
Projects
Qt Protobuf
  
ToDo
Development

No branches or pull requests

2 participants