Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Refactored and improved project #38

Open
bolshoy opened this issue Jun 30, 2016 · 11 comments
Open

Refactored and improved project #38

bolshoy opened this issue Jun 30, 2016 · 11 comments

Comments

@bolshoy
Copy link
Contributor

bolshoy commented Jun 30, 2016

@silvolu please take a look at our fork https://github.com/rounds/go-gcm

  • code refactored, http and xmpp clients separated
  • monitors xmpp connection with xmpp pings, redials when it fails
  • handles CONNECTION_DRAINING properly
  • graceful close
  • improved logging with logrus
  • various govet/golint fixes
  • Travis and Codecov added

The project runs in production for a couple of months, looks good)

@silvolu
Copy link
Contributor

silvolu commented Jul 29, 2016

@bolshoy That's pretty cool! Would you mind if we pointed people to your project for a more complete/stable version of the library? Unfortunately (as you might see from the state of issues and PR), I don't really have time anymore to work on this library.

@appleboy
Copy link
Contributor

@silvolu @bolshoy Nice work.

@bolshoy
Copy link
Contributor Author

bolshoy commented Jul 31, 2016

@silvolu sure, you can point people to it.
@appleboy thanx

@kuchlous
Copy link

kuchlous commented Sep 2, 2016

@bolshoy , frequently I receive many copies of the same upstream GCM. I can see multiple messages with the same message ID and identical content in the log file that rounds/go-gcm generates in the debug mode. I think the app is not sending duplicate messages.

Do you see such behavior as well?

@bolshoy
Copy link
Contributor Author

bolshoy commented Sep 4, 2016

@kuchlous there's a retry functionality in http request. But I suggest to update to a newer version, fixed some problems related to connection draining.

@kuchlous
Copy link

kuchlous commented Sep 4, 2016

@bolshoy, I have updated the code.

My question was about google sending multiple copies of a GCM message that
was sent upstream (to my server) by the app.

On Sun, Sep 4, 2016 at 4:27 PM David Bolshoy [email protected]
wrote:

@kuchlous https://github.com/kuchlous there's a retry functionality in
http request. But I suggest to update to a newer version, fixed some
problems related to connection draining.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#38 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABJZayEJH9pWbWzZ-mum8ULrWGGoTavpks5qmqQSgaJpZM4JCIXH
.

@bolshoy
Copy link
Contributor Author

bolshoy commented Sep 5, 2016

@kuchlous interesting, never checked the correctness of it. Maybe something to do with xmpp acks on upstream messages, though they are sent immediately after. Mind having a look?
Also I suggest to move the discussion to rounds/go-gcm as an issue.

@kuchlous
Copy link

kuchlous commented Sep 5, 2016

@bolshoy, I can see the acks sent by the xmpp server being logged in the
log file. Would extracts from my logfile be useful to you?

I would be happy to take a look myself if you give me some suggestions..

On Mon, Sep 5, 2016 at 12:20 PM David Bolshoy [email protected]
wrote:

@kuchlous https://github.com/kuchlous interesting, never checked the
correctness of it. Maybe something to do with xmpp acks on upstream
messages, though they are sent immediately after. Mind having a look?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#38 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABJZazHILQ4o3sidiDtrFvkZoWne4Ksaks5qm7vMgaJpZM4JCIXH
.

@kuchlous
Copy link

kuchlous commented Sep 8, 2016

@bolshoy , I see this error in my XMPP server log:

time="2016-09-08T00:06:13Z" level=error msg="gcm xmpp listen" error="error on Recv: XML syntax error on line 1: unexpected EOF" xmpp client ref=0xc832c76ea0

After this my XMPP server stopped accepting GCM messages.

Two questions:

  1. Is it expected that there can be errors in the received XML? Could this happen if the connection dropped in the middle of a receive?
  2. What is the expected behavior on the server? Should it not just disregard this message and move on?

BTW, would it make sense to enable issues on your repo so that these discussions can happen there?

@bolshoy
Copy link
Contributor Author

bolshoy commented Sep 8, 2016

@kuchlous
the error is expected, the connection was closed abruptly. The service should identify that the connection was closed and recreate an internal xmpp client.
You can now use the issues on the repo, thanx for pointing out.

@kuchlous
Copy link

kuchlous commented Sep 8, 2016

@bolshoy

I do see that the service restarted the xmpp client for a similar error in earlier case:

time="2016-09-07T08:53:42Z" level=error msg="gcm xmpp listen" error="error on Recv: XML syntax error on line 1: unexpected EOF" xmpp client ref=0xc8203c5a70
time="2016-09-07T08:53:42Z" level=warning msg="gcm xmpp connection closed" error="error on Recv: XML syntax error on line 1: unexpected EOF" xmpp client ref=0xc8203c5a70
<stream:stream from="gcm.googleapis.com" id="72FCE82243A41E8C" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
stream:featuresX-OAUTH2X-GOOGLE-TOKENPLAIN/stream:features

<stream:stream from="gcm.googleapis.com" id="3659B338B04085EC" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
stream:features/stream:features
[email protected]/4707DC7C
time="2016-09-07T08:53:42Z" level=warning msg="gcm xmpp client replaced" previous xmpp client ref=0xc8203c5a70 xmpp client ref=0xc832c76ea0

But for some reason it did not restart on the same error the second time. I will stare at the code some more to see if I can spot anything.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants