Glitch projecting constantly disconnecting and reconnecting **not storage related**

I recently started using Glitch as a platform for my web design class. I’ve been really happy with everything so far, but one of my students has been really struggling with a recurring error. When she is editing her project Glitch keeps disconnecting and reconnecting. Sometimes, the project will reload to an earlier state so whatever changes she’s made are lost. As you can imagine, this has made working on her project incredibly difficult.

The project name is bhocolate-bhip-bookie and it’s a remix of a template I developed called cosmic-yard. There are six other students in the class, but none of them appear to be having the same issue.

Searching through the forum I’ve found a number of references to memory/storage causing similar issues, but looking at the Container status the project is only using 29MB of memory and 2MB of storage (we’ve only just started our projects). I then had the student pull up the Console Logs and immediately saw a number of errors. I launched debug and was treated to the following error message:

Error: listen EADDRINUSE: address is already in use : : :3000
at Server…
at listenInCluster
…etc.

I’m afraid diagnosing beyond this point is a bit out of my wheelhouse. Can anyone from the Glitch team take a look or provide some guidance on how to resolve this issue?

Thanks!

Can I see how you’re declaring your port?

Hi Edwarddd…could you walk me through how to give you that information?

If it helps the student has had issues both on and off campus, so I don’t believe the problem is related to any kind of firewall settings (especially since none of the other students have had problems while accessing their projects on campus).

I also didn’t customize or otherwise alter the base project (cosmic-yard). It’s simply a remix of the default starter site.

I’m afraid I’m very much a front-end guy so you’ll need to walk me through some of the more technical steps.

Thanks for your help!

I agree, that looks like weird or buggy behavior. I’m sorry.

Yes, I don’t think ~cosmic-yard or ~bhocolate-bhip-bookie looks particularly strange or different from other static sites on Glitch like ~hello-website

One thing, which shouldn’t matter - is the apostrophe in the filename common among your students’s projects, or is it unique to this student’s files?

Is the student’s router express? If so, then find the app.listen(...) and make sure that process.env.PORT goes inside the parenthesis.

For other routers make sure that you’re setting the port to the assigned port. This error originated when you try to listen to a port that you’re not assigned to.

bhocolate-bhip-bookie is a simple web page project, so the web server its using is lws. I don’t see any custom configuration there.

The likely problem is, on a restart the server didn’t shut down properly, and a new instance was started, and reported an error because the port was already being used.

See if these steps fix the issue…

A. Open a console from the editor > Tools > Full page console

B. Type in the following at the prompt (not including the itself)

$ ps aux | grep ws

Its should show something like …

app        154  0.0  0.0   4504   744 ?        SN   05:44   0:00 /bin/sh /opt/nvm/versions/node/v10/bin/ws --port 3000 --log.format combined --directory . --blacklist /.(.*)
app        170  0.0  0.0  12944   940 pts/1    S+   05:45   0:00 grep ws

The number in the second column is the process identifier (pid). This shows processes which have “ws” in them, plus the process that is looking for them. You may have more than one.

C. Note the pid, then put it into the following,

$ kill 154

Do the same for each pid if you have more than one ws process.

This will stop the web server process, and Glitch will restart it automatically.

D. Then go back to the project editor, Tools > Logs, you may see something like

/opt/watcher/app-types/static/start.sh: line 19:    154 Killed

Serving at http://4cd3:3000, http://127.0.0.1:3000, http://172.117.10.125:3000
1 Like