expo-cli icon indicating copy to clipboard operation
expo-cli copied to clipboard

Host remains without network after a while

Open bogdan-calapod opened this issue 8 years ago • 32 comments

Description

Okay, so this is a bit of a weird one, but I will try my best to explain what happens

Expected Behavior

  • Start expo cli
  • Work without any network issues

Observed Behavior

  • Start expo cli
  • Work without any network issues for a while
  • After a while (5-10 minutes) all network requests (e.g. browser pages, stuff like that) fail
  • Expo reports a network connectivity problem with the tunnel (the same error that shows when turning off WiFi)

The weird thing is:

  • ping works
  • Windows reports having internet connectivity
  • telnet on port 80 fails

Environment

Please run expo diagnostics in the project folder and copy the output here:

Environment:
  OS: Windows 10 version1809 build 17763.55 with WSL
  Node: 10.12.0
  npm: 6.4.1

Packages: (wanted => installed)
  expo: ^30.0.0 => 30.0.1
  react: 16.3.1 => 16.3.1
  react-native: https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz => 0.55.4

Diagnostics report:
  https://exp-xde-diagnostics.s3.amazonaws.com/bogdan.marius.calapod-40e5c934-3c30-4ed2-b306-07524d995597.tar.gz

Phone:
  Xiaomi Redmi Note 4 running Android 8.1.0

Reproducible Demo

This seems to happen without any specific project - even new expo projects show this behavior

What I've tried

  • Resetting the network adapter
  • Uninstalling and reinstalling network adapter
  • Running the Windows 10 network troubleshooter
  • Running the reset network tool in the Windows 10 Settings
  • Connecting an ethernet/USB tether to attempt restoring network connectivity
  • Turning off Windows Firewall and Windows Defender
  • Running ipconfig /flushdns
  • Reinstalling Windows 10 and only installing node to run expo-cli
  • All of the above with expo killed after tunnel error

This is driving me nuts and I can't figure out how to debug it properly. It only happens when running Expo apps - I also do a lot of web development and CRA, Gatsby and the like don't cause network problems, so I guess it's something specific to expo-cli.

I have no antivirus or firewall apart from those that came with Windows

bogdan-calapod avatar Oct 18 '18 18:10 bogdan-calapod

Small repro update - I noticed that simply starting expo start and waiting for a while reproduces the same issue. Any ideas on how I could debug more into this issue ?

bogdan-calapod avatar Nov 17 '18 17:11 bogdan-calapod

Adding to this issue. If expo is started on Windows but on Linux Subsystem (wsl) internet requests fail imedeately. I have tried the same things as OP but the only way I could restore internet connection was via a reboot. Observed behaviour is the same except for:

  • ~~Work without any network issues for a while~~
  • ~~After a while (5-10 minutes)~~ Immedeately all network requests (e.g. browser pages, stuff like that) fail

With Windows using command prompt this issue is not present

duckyb avatar Dec 04 '18 08:12 duckyb

Having the same issue on WSL (linux subsystem for Windows). Expo is running fine but after +/- 5 minutes all connections are dropped. Ping works, Windows reports no issues but getting a no internet connection in all browsers & applications. Need to restart my PC before it's fixed.

Anyone have any more info how to work around this?

mbardelmeijer avatar Feb 27 '19 18:02 mbardelmeijer

Same problem here

codephi avatar Mar 08 '19 04:03 codephi

I found a palliative solution not to restart the machine:

1 - WIN+R -> services.msc 2 - Find LxssManager 3 - Right-click -> Restart

This should restart the WSL service, normalizing the network.

codephi avatar Mar 08 '19 04:03 codephi

Facing the same issue! At least I know I am not being haunted. I was using expo without problem on my mac until it broke down. To save some money I bought a Windows laptop and this issue was driving me crazy. What does restarting LxssManager do?

naiemk avatar Mar 10 '19 23:03 naiemk

LxssManager is the service that manages the layer that communicates between Windows and Linux. Restarting it is basically equivalent to restarting Windows regarding everything that happens in WSL.

bogdan-calapod avatar Mar 11 '19 15:03 bogdan-calapod

Obs: When I run the expo-cli start in CMD and then run on WSL, a network does not fail anymore....

codephi avatar Mar 13 '19 20:03 codephi

I ran this same problem, first I thought it was problem I faced if using tunnel, but other options do very same.

I found related warnings from event viewer, maybe these give some direction where to continue debugging: first event

Log Name:      System
Source:        Tcpip
Date:          17.3.2019 18.31.05
Event ID:      4231
Task Category: None
Level:         Warning
Keywords:      Classic
User:          N/A
Computer:      mylaptop
Description:
A request to allocate an ephemeral port number from the global TCP port space has failed due to all such ports being in use.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Tcpip" />
    <EventID Qualifiers="32768">4231</EventID>
    <Level>3</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2019-03-17T16:31:05.020635700Z" />
    <EventRecordID>5313</EventRecordID>
    <Channel>System</Channel>
    <Computer>mylaptop</Computer>
    <Security />
  </System>
  <EventData>
    <Data>
    </Data>
    <Binary>00000000010000000000000087100080000000000000000000000000000000000000000000000000</Binary>
  </EventData>
</Event>

second event

Log Name:      System
Source:        Tcpip
Date:          17.3.2019 18.33.58
Event ID:      4227
Task Category: None
Level:         Warning
Keywords:      Classic
User:          N/A
Computer:      mylaptop
Description:
TCP/IP failed to establish an outgoing connection because the selected local endpoint was recently used to connect to the same remote endpoint. This error typically occurs when outgoing connections are opened and closed at a high rate, causing all available local ports to be used and forcing TCP/IP to reuse a local port for an outgoing connection. To minimize the risk of data corruption, the TCP/IP standard requires a minimum time period to elapse between successive connections from a given local endpoint to a given remote endpoint.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Tcpip" />
    <EventID Qualifiers="32768">4227</EventID>
    <Level>3</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2019-03-17T16:33:58.000531100Z" />
    <EventRecordID>5314</EventRecordID>
    <Channel>System</Channel>
    <Computer>mylaptop</Computer>
    <Security />
  </System>
  <EventData>
    <Data>
    </Data>
    <Binary>00000000010000000000000083100080000000000000000000000000000000000000000000000000</Binary>
  </EventData>
</Event>

Restarting LxssManager restores network connectivity immediately. My system Windows 10 Pro, Version 1809, OS Build 17763.379 Expo was started inside wsl.

kerbe avatar Mar 17 '19 16:03 kerbe

This is likely an issue with WSL. There is an issue for this at https://github.com/Microsoft/WSL/issues/2913.

MoeRT09 avatar Mar 28 '19 15:03 MoeRT09

I created docker container which prevents this issue from happening. For saving trouble from others to create build similar, it can be found here: https://hub.docker.com/r/kerbe/expo There is also information how to get hot reload working, as that is also problem with WSL/Windows Docker.

kerbe avatar Mar 29 '19 02:03 kerbe

Same issue here using WSL. But any google site works fine. WHY??

Any workaround at the moment?

mazyvan avatar Apr 01 '19 22:04 mazyvan

I had the same problem here.It's not the best solution but help me a lot!!!! THX!

troyam avatar Apr 06 '19 18:04 troyam

I am having the same problem. It only seems to happen with Expo, otherwise WSL works fine.

nicholmikey avatar Apr 13 '19 19:04 nicholmikey

Can confirm that Windows Insider Build 18890 fixes this issue.

umamialex avatar May 08 '19 06:05 umamialex

I have the same problems! I hope Microsoft to solve this problem

jeonghoheo avatar May 29 '19 06:05 jeonghoheo

I simuled two VM's with Oracle now with OSX. I'm disappointed with Windows but not surprised.

Em seg, 22 de jul de 2019 02:23, Andrew Jongyun Kim < [email protected]> escreveu:

I brought my answer from stackoverflow

I had stuck on the same issue. To solve this, I have to reboot whole PC or restart LxssManager manually.

net stop LxssManager net start LxssManager

Then, I found which one causes this problem while I was testing many things on Expo.

Instead of using Hot reloading, I used Live Reload as functional component doesn't have render().

There is only one exception that does not cause the issue even though I run expo and connected with my iphone through the Expo client. If I do not change any code and the live loading never worked at least once, the internet was alive. So, I figured it out that Live Reload causes this issue.

So, do disable Live Reload and do Reload JS Bundle manually.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/expo/expo-cli/issues/99?email_source=notifications&email_token=AG5A52GEF4IMLR7EOUJA46TQAU73VA5CNFSM4F5ZSNGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2OZPSY#issuecomment-513644491, or mute the thread https://github.com/notifications/unsubscribe-auth/AG5A52H2YCV2OPJS65PGTKDQAU73VANCNFSM4F5ZSNGA .

troyam avatar Jul 22 '19 08:07 troyam

@troyamtec I deleted my comment that was not correct solution for this issue. I realized, the debugging cause very serious crash to internet connection. Live reload is fine if there is no syntax error.

ajkimdev avatar Jul 22 '19 09:07 ajkimdev

~~this issue makes me cannot sleep now lol.~~ ~~I updated node 8 to 10~~ ~~reinstalled expo~~ ~~but still it caused problem.~~ ~~However, it seems working well now lol~~ ~~adding in .zshrc or .bash_profile~~ ~~export EXPO_DEBUG=true~~

~~is there anyone try this? and tell me what your result.~~ ~~Thank you~~

Never mind, I just bring out my old macbook air :P

ajkimdev avatar Jul 22 '19 11:07 ajkimdev

Same here. Subscribing to this thread in case there is a fix. Maybe switching to the new WSL2 will fix this, but I was on the fast track Insider Program and ran into issues with VirtualBox, so I've dropped back to the slow track. If anyone out there is on the fast track, try switching (instructions) and see if it works.

da-mask avatar Jul 30 '19 06:07 da-mask