Skip to content

timeout issue in node modules #1833

Closed
Closed

Description

@kabalage

I'm trying to use socket.io-client from electron v0.27.1, but connecting to the server does not work like expected.

main.js - my electron app
client.js - client without electron, this works
server.js

  1. running main.js with electron path/to/my/app while server.js is running, I get timeouts
  2. if I put the call to initSocket() in main.js before app.on(ready", ...) it successfully connects but I have to wait like 25 seconds before it happens
  3. running client.js with io.js v1.6.3 works like a charm (even with the same socket.io options as in main.js)

Any idea what's happening?

Activity

  1. changed the title [-]socket.io-client timeout in electron [/-] [+]socket.io-client timeout[/+] on Jun 1, 2015
  2. zcbenz commented on Jun 3, 2015

    @zcbenz
    Contributor

    Which operating system are you using? And have you tried v0.27.2?

  3. kabalage commented on Jun 3, 2015

    @kabalage
    Author

    Yes, the issue is still there in v0.27.2. I'm using Ubuntu 14.04

    Also there's an error that does not appear in case#2 (described above) besides the sandbox error, here is the log of case#1:

    [11658:0603/173841:ERROR:browser_main_loop.cc(173)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
    app ready
    initSocket
    [11679:0603/173841:ERROR:sandbox_linux.cc(340)] InitializeSandbox() called with multiple threads in process gpu-process
    connect_error { '0': 'timeout' }
    connect_timeout { '0': 1000 }
    reconnect_attempt { '0': 1 }
    reconnecting { '0': 1 }
    connect_error { '0': 'timeout' }
    reconnect_error { '0': 'timeout' }
    connect_timeout { '0': 1000 }
    ...
    

    and here is case#2:

    [11887:0603/174416:ERROR:browser_main_loop.cc(173)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
    initSocket
    app ready
    electronReady
    

    before electronReady it hangs for about 25 seconds, messaging with the app after this works.

  4. zcbenz commented on Jun 4, 2015

    @zcbenz
    Contributor

    Looks like a bug of the uv message loop integration, but socket.io-client has too many abstractions around the actual call, I can not find out the root cause.

  5. leyenda commented on Feb 6, 2016

    @leyenda

    +1 | This keeps happening on linux(tested on ubuntu 15.10 and raspbian), on windows it works fine. Im using electron 0.36.0 and for socket.io and socket.io-client 1.4.5.

    But now it doesnt even show a timeout, Chromium show the websockets with a 101 status and keeps opening more and more sockets but no data can be transfer.

    Socket.io-client keeps working alone on linux, but not with electron.

  6. andresmeidla commented on May 18, 2016

    @andresmeidla

    The error happens to this setup also:
    Ubuntu 16.04, electron 0.37.0, socket.io-client 1.4.6

  7. leyenda commented on May 19, 2016

    @leyenda

    I've finally done it, it seems like a problem with XHR / JSONP polling transport.
    I am using electron 1.0.2 and socket.io 1.4.6

    Just specify in your client when setting the connection that you only want to use websockets.

    var socket = require('socket.io-client')('http://localhost:5000', { transports: [ "websocket" ] });

    Hope this helps

  8. andresmeidla commented on May 19, 2016

    @andresmeidla

    Forcing it to use websockets as transport doesn't seem to be a solution (at least for me).
    I tried it a couple of days ago, and it seemed to work fine at first - client connected right away, messages got delivered etc.
    But the error returned after some time (couple of hours and lots of connecting/disconnecting, appliance restarts).
    So my guess is that all it did is change some internal timing so that it happened to succeed at first.

  9. changed the title [-]socket.io-client timeout[/-] [+]timeout issue in node modules[/+] on Jul 12, 2016
  10. darky commented on Jul 13, 2016

    @darky

    This issue affected on mongodb and elasticsearch too.

  11. darky commented on Jul 13, 2016

    @darky

    Also, I notice, timeout occured if using dnshostname instead ip. If indicate clearly ip, all fine.

  12. junedev commented on Aug 16, 2016

    @junedev

    I am also affected by this (Ubuntu 15.10, electron-prebuilt 1.2.8, socket.io-client 1.4.8). I had the same experience as @andresmeidla, forcing websocket transport didn't fix it in the end.
    Thanks to @darky! Switching from "localhost" to the ip seems to work for now, at least for testing locally.

  13. niftynei commented on Feb 23, 2017

    @niftynei

    i'm experiencing this as well. Ubuntu 16.04 LTS, electron version 1.6.1. It happens for all /etc/hosts entries. Changing to the IP address (127.0.0.1) fixes the problem.

    I've tested other endpoints (non-local) and they work as expected. This bug is unpredictable -- I've run electron apps on this computer for a while now without a problem. I tried using strace to track down the problem -- shows "-1 EACCESS Resource Not Available".

    I haven't figured out a way to fix it. I'm planning to reboot my machine shortly.

  14. notsyncing commented on Mar 6, 2017

    @notsyncing

    Same here on Ubuntu 16.10, electron 1.6.1, connecting to some port on localhost with http.request.
    The request never finish, and no error was thrown.
    As @niftynei said, change the localhost to 127.0.0.1 fixed the problem.
    The same version of electron, on a macOS 10.12.3, does not affected by this problem.

  15. janekolszak commented on Mar 12, 2017

    @janekolszak

    I have the same problem: Ubuntu 16.04, electron 1.6.3 prerelease, using electron's net module

  16. codebytere commented on Sep 27, 2017

    @codebytere
    Member

    Closing due to lack of activity

  17. redders6600 commented on Sep 27, 2017

    @redders6600

    What does closed due to abandonment mean? Abandoned by whom? I think a lot of people would still consider this an issue...

  18. codebytere commented on Sep 27, 2017

    @codebytere
    Member

    We're closing some old issues if they haven't seen activity in a significant amount of time and it seems like it's less of an issue. If it still is, i'll absolutely reopen it; it's just an effort to tame the hydra that is our issues tab 🐍

  19. PsyTae commented on Oct 25, 2017

    @PsyTae

    vsCode and gitKraken are both affected by this issue "100 CPU on a single CPU Windows Machine". Very Detrimental on Virtual Machines such as AWS EC2 instances.
    Tried to install both of these electron apps on an m3.medium instance and it brought everything to a halt on the virtual machine.
    VS Code #17097

  20. jampy commented on Jan 4, 2018

    @jampy

    Anyone got a solution for this?

    Even extremely simple commands like fs.stat() a single file take seconds to complete. That's crazy.

    I tried with spawning a separate process to do the I/O, but that still causes the CPU to go at 100%.

    Why is the Electron autoUpdate not affected by this?

  21. gshively11 commented on Feb 26, 2018

    @gshively11

    I created a new issue with a possible fix for this problem. My initial tests look promising, but I need some experts to chime in before making any definitive claims. #12026

  22. codebytere commented on Nov 1, 2018

    @codebytere
    Member

    Given that there is a new open issue to address some of the underlying cause here, and that this isn't currently on our roadmap, i'm going to go ahead and label this a wontfix. However, should someone determine a workable solution we would be very open to accepting a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions