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

Memory leak #51

Open
Sorunome opened this issue Jul 28, 2017 · 3 comments
Open

Memory leak #51

Sorunome opened this issue Jul 28, 2017 · 3 comments
Labels

Comments

@Sorunome
Copy link
Contributor

There appears to be some kind of memory leak after running this for a longer period of time (only noticed after a few days)

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [node]
 2: 0x55f2e3fefb6e [node]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
 5: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [node]
 6: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [node]
 7: v8::internal::String::Flatten(v8::internal::Handle<v8::internal::String>, v8::internal::PretenureFlag) [node]
 8: v8::String::WriteUtf8(char*, int, int*, int) const [node]
 9: node::StringBytes::Write(v8::Isolate*, char*, unsigned long, v8::Local<v8::Value>, node::encoding, int*) [node]
10: node::StreamBase::Writev(v8::FunctionCallbackInfo<v8::Value> const&) [node]
11: void node::StreamBase::JSMethod<node::TLSWrap, &node::StreamBase::Writev>(v8::FunctionCallbackInfo<v8::Value> const&) [node]
12: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [node]
13: 0x55f2e36f5236 [node]
14: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node]
15: 0x15935b1840bd

While right before that i get a bunch of

An error was detected:
{ poll: Unable to poll the messages
  caused by UnexpectedHttpStatus: Received response with the HTTP status code `404` but expected one of [200]. Request: {"uri":"https://db5-client-s.gateway.messenger.live.com/v1/users/ME/endpoints/SELF/subscriptions/0/poll","cookies":{"idx":{"skype.com":{"/":{"SC":{"key":"SC","value":"CC=:CCY=:LC=en:LIM=:TM=1500725790:TS=1500725790:TZ=:VAT=:VER=","expires":"2018-07-22T12:16:30.000Z","maxAge":31536000,"domain":"skype.com","path":"/","hostOnly":false,"creation":"2017-07-22T12:16:30.744Z","lastAccessed":"2017-07-22T12:16:34.025Z"}}},"login.skype.com":{"/":{"login-vi":{"key":"login-vi","value":"-snip-","domain":"login.skype.com","path":"/","hostOnly":true,"creation":"2017-07-22T12:16:30.745Z","lastAccessed":"2017-07-22T12:16:30.746Z"}}},"login.live.com":{"/":{"uaid":{"key":"uaid","value":"-snip-","domain":"login.live.com","path":"/","secure":true,"httpOnly":true,"extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.279Z","lastAccessed":"2017-07-22T12:16:31.818Z"},"MSPRequ":{"key":"MSPRequ","value":"lt=1500725791&co=1&id=293290","domain":"login.live.com","path":"/","secure":true,"httpOnly":true,"extensions":["version=1"],"hostOnly":true,"creation":"2017-07-22T12:16:31.280Z","lastAccessed":"2017-07-22T12:16:31.350Z"},"MSPOK":{"key":"MSPOK","expires":"1980-10-30T16:00:00.000Z","domain":"login.live.com","path":"/","httpOnly":true,"extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.280Z","lastAccessed":"2017-07-22T12:16:31.819Z"},"CkTst":{"key":"CkTst","value":"1500725791349","domain":"login.live.com","path":"/","hostOnly":true,"pathIsDefault":true,"creation":"2017-07-22T12:16:31.349Z","lastAccessed":"2017-07-22T12:16:31.350Z"},"PPAuth":{"key":"PPAuth","value":"-snip-","domain":"login.live.com","path":"/","secure":true,"httpOnly":true,"extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.819Z","lastAccessed":"2017-07-22T12:16:31.819Z"},"MSPShared":{"key":"MSPShared","expires":"1980-10-30T16:00:00.000Z","domain":"login.live.com","path":"/","httpOnly":true,"hostOnly":false,"creation":"2017-07-22T12:16:31.819Z","lastAccessed":"2017-07-22T12:16:31.819Z"},"MSPPre":{"key":"MSPPre","value":"-snip-","expires":"2037-12-30T16:00:00.000Z","domain":"login.live.com","path":"/","secure":true,"hostOnly":false,"creation":"2017-07-22T12:16:31.820Z","lastAccessed":"2017-07-22T12:16:31.820Z"},"MSPCID":{"key":"MSPCID","value":"-snip-","expires":"2037-12-30T16:00:00.000Z","domain":"login.live.com","path":"/","secure":true,"httpOnly":true,"hostOnly":false,"creation":"2017-07-22T12:16:31.820Z","lastAccessed":"2017-07-22T12:16:31.820Z"},"WLOpt":{"key":"WLOpt","value":"credtype=1&act=[1]","expires":"2037-12-30T16:00:00.000Z","domain":"login.live.com","path":"/","secure":true,"hostOnly":false,"creation":"2017-07-22T12:16:31.820Z","lastAccessed":"2017-07-22T12:16:31.820Z"},"MSPVis":{"key":"MSPVis","value":"$293290","domain":"login.live.com","path":"/","secure":true,"hostOnly":false,"creation":"2017-07-22T12:16:31.820Z","lastAccessed":"2017-07-22T12:16:31.820Z"},"LOpt":{"key":"LOpt","value":"1","domain":"login.live.com","path":"/","extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.820Z","lastAccessed":"2017-07-22T12:16:31.820Z"},"SDIDC":{"key":"SDIDC","value":"-snip-","expires":"2037-12-30T16:00:00.000Z","domain":"login.live.com","path":"/","secure":true,"httpOnly":true,"extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.821Z","lastAccessed":"2017-07-22T12:16:31.821Z"},"MSPSoftVis":{"key":"MSPSoftVis","value":"@72198325083833620@:@","domain":"login.live.com","path":"/","secure":true,"extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.821Z","lastAccessed":"2017-07-22T12:16:31.821Z"},"MSPBack":{"key":"MSPBack","value":"0","domain":"login.live.com","path":"/","extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.821Z","lastAccessed":"2017-07-22T12:16:31.821Z"}}},"live.com":{"/":{"PPLState":{"key":"PPLState","value":"1","domain":"live.com","path":"/","extensions":["version=1"],"hostOnly":false,"creation":"2017-07-22T12:16:31.819Z","lastAccessed":"2017-07-22T16:52:10.263Z"}}}}},"headers":{"RegistrationToken":"registrationToken=-snip-; expires=1500812190; endpointId={2b4a70a9-4ff3-493c-8371-d21e1b46f2c8}"}}, Response: [object Object]  
    at Object.create (/home/sorunome/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/errors/http.js:21:16)
    at MessagesPoller.<anonymous> (/home/sorunome/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/polling/messages-poller.js:300:68)
    at Generator.next (<anonymous>)
    at fulfilled (/home/sorunome/matrix-puppet-skype/node_modules/skype-http/dist/lib-es2015/lib/polling/messages-poller.js:4:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)
  name: 'poll',
  data: {},
  cause:

Where at cause it just keeps on repeating those.

Perhaps the polling is written in some recursive way which would also explain the memory leak? Is it handled already to automatically re-authenticate after your token expires?

@mitchcapper
Copy link
Collaborator

That is interesting. I use this plugin in a long term use case and have not run into the memory issue, but I do abort on failure. The polling problem is an arror and right now recovery is sketchy. Best is to catch an error disconnect the classes, and do a full new instance to reconnect. It will rarely recover on its own from poll failures.

@Sorunome
Copy link
Contributor Author

Sorunome commented Jul 29, 2017

This could maybe be applied to the lib itself - have it catch poll 404 errors and restart the entire thing on them

EDIT: Mind showing your reconnect on polling error code for a quick solution?

@mitchcapper
Copy link
Collaborator

Agreed, we do not want to store creds so it is somewhat waiting on #39

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

No branches or pull requests

3 participants