GithubHelp home page GithubHelp logo

Comments (34)

2fours avatar 2fours commented on August 23, 2024

Hung again last night...going to try this change in production will let you know.

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

Checking this.

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

Timeout is getting called. you can try this by reducing timeout to 1 ms.

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

But I am facing the same problem related to random hanging. :(

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

Are you getting error message
: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit. ?

from node-gcm.

2fours avatar 2fours commented on August 23, 2024

No. Does adding callback("timeout", null) on line 96 fix the issue? Eg.

    post_req.on('socket', function (socket) {
        socket.setTimeout(timeout);
        socket.on('timeout', function() {
            post_req.abort();
            callback("timeout", null);
        });
    });

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

I think it should not make any difference. Did you tried decreasing timeout to 1 ms. As timeout is getting called I think something else is issue.

from node-gcm.

2fours avatar 2fours commented on August 23, 2024

Yes you might be right, the server doesn't hang when i set timeout to 1 ms.

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

What is your node version ?

from node-gcm.

2fours avatar 2fours commented on August 23, 2024

Sorry I meant to say the server doesn't hang when timeout is 1 ms. 0.10.22

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

Did you find anything ?

from node-gcm.

2fours avatar 2fours commented on August 23, 2024

No did you?

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

No.

regards
Vivek Goel

On Fri, Dec 6, 2013 at 7:40 PM, 2fours [email protected] wrote:

No did you?


Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-29996654
.

from node-gcm.

2fours avatar 2fours commented on August 23, 2024

Wonder if it could be related to keep-alive being true by default: http://nodejs.org/api/http.html#http_class_http_agent

from node-gcm.

2fours avatar 2fours commented on August 23, 2024

I added more logging to my server and it looks like the hang occurs before it even tries to send. My server code looks like: (link here: https://github.com/surespot/web-server/blob/master/server/cluster.coffee#L1050)

        logger.debug "sending gcms for message"
        gcmmessage = new gcm.Message()
        sender = new gcm.Sender("#{googleApiKey}")
        gcmmessage.addData("type", "message")
        gcmmessage.addData("to", message.to)
        gcmmessage.addData("sentfrom", message.from)
        gcmmessage.addData("mimeType", message.mimeType)
        #pop entire message into gcm message if it's small enough
        if messagejson.length <= 3800
          gcmmessage.addData("message", messagejson)

        gcmmessage.delayWhileIdle = false
        gcmmessage.timeToLive = GCM_TTL

        logger.debug "sending push messages to: #{ids[0]}"
        sender.send gcmmessage, gcmIds, 4, (err, result) ->
          return logger.error "Error sending gcm: #{err}" if err? or not result?
          logger.debug "sendGcm result: #{JSON.stringify(result)}"

          if result.failure > 0
            removeGcmIds message.to, gcmIds, result.results

Right now one of my server processes is hung and the last log entry is "sending gcms for message", not "sending push messages to ..." as one would expect.

from node-gcm.

2fours avatar 2fours commented on August 23, 2024

Looking at this code for the first time in a while I notice that I'm creating a new Sender for every gcm message I want to send. Wonder if this has anything to do with it. Are you creating a new Sender or re-using one sender?

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

On 08-Dec-2013 10:54 PM, "2fours" [email protected] wrote:

Looking at this code for the first time in a while I notice that I'm
creating a new Sender for every gcm message I want to send. Wonder if this
has anything to do with it. Are you creating a new Sender or re-using one
sender?

No. I am using the same Sender object.


Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-30086122
.

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

Do you have test case for hanging ? or is it randomly hanging for you ?

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

And can you provide more details. Like:
What are the memory usages and cpu usages at that time ?

from node-gcm.

2fours avatar 2fours commented on August 23, 2024

No test case, it's random. CPU usage stays the same but memory usage grows until I restart the process.

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

If removing those 3 lines of dealing with setTimeout solves your problem ?

from node-gcm.

RomanIakovlev avatar RomanIakovlev commented on August 23, 2024

Sounds like something is trying to JSON.stringify() some object with cyclic reference. I observed exactly same behavior (no CPU usage, constant memory growth) before, and the reason was JSON.stringify().

Edit: Luckily, there's only one reference to JSON.stringify() in the code, and that is requestBody = JSON.stringify(body); in sender.js. Is there some way to get rid of that call and re-test?

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

can you use util.inspect to log circular JSON object ?

regards
Vivek Goel

On Tue, Dec 10, 2013 at 9:48 PM, RomanIakovlev [email protected]:

Sounds like something is trying to JSON.stringify() some object with
cyclic reference. I observed exactly same behavior (no CPU usage, constant
memory growth) before, and the reason was JSON.stringify().


Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-30241630
.

from node-gcm.

RomanIakovlev avatar RomanIakovlev commented on August 23, 2024

@2fours:

I added more logging to my server

I had an experience when log output stopped earlier than hitting the line where hang happens, still referring to the case where I had cyclic reference in argument of JSON.Stringify().

from node-gcm.

2fours avatar 2fours commented on August 23, 2024

I'm not calling JSON.Stringify() before sending the message.

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

@2fours Is your issue solved after latest update ?

from node-gcm.

2fours avatar 2fours commented on August 23, 2024

I haven't updated yet, I'm not 100% sure it is node-gcm yet. I've added more logging to the server to make sure. Once I'm 100% sure I will upgrade and see if it fixes the issues.

from node-gcm.

2fours avatar 2fours commented on August 23, 2024

@goelvivek are you using winston by any chance for logging?

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

No. I am not using it.
On 22-Dec-2013 3:39 AM, "2fours" [email protected] wrote:

@goelvivek https://github.com/goelvivek are you using winston by any
chance for logging?


Reply to this email directly or view it on GitHubhttps://github.com//issues/36#issuecomment-31073469
.

from node-gcm.

2fours avatar 2fours commented on August 23, 2024

I've made 2 changes, replaced winston with bunyan, and upgraded node to 0.10.23, and my server has been stable for 2 days. Holding off on calling it "fixed" but it looks promising.

from node-gcm.

lordnynex avatar lordnynex commented on August 23, 2024

I'm experiencing this same issue. I'm noticing the hang on messages that have really weird UTF-8 characters. These are my initial findings (60 minutes in) so take it with a grain of salt. Do you think this is a possibility?

from node-gcm.

goelvivek avatar goelvivek commented on August 23, 2024

@lordnynex
Are you using latest version ?
Was hang happened approx 2014-01-01 19:40:23 GMT ?

from node-gcm.

hypesystem avatar hypesystem commented on August 23, 2024

Hello guys! It's now been quite a while since you last checked this bug. Can you see if it is still present? If so, what are the steps to reproduce?

Sorry to poke you affter so long (I mean, the last comment on here was from 3 Jan 2014), but I'd like to know if this issue persists.

from node-gcm.

hypesystem avatar hypesystem commented on August 23, 2024

No new reports of this problem, no idea if it is still one. Gonna close this.

from node-gcm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.