tpetry / stackbricks-community

Issue and Feature Tracker for the StackBricks database management software
6 stars 0 forks source link

BUG: Changing "already used port" doesn't work #3

Open AndreSchwarzer opened 2 years ago

AndreSchwarzer commented 2 years ago

Description

After changing the port for a DB, StackBricks seems to be stuck in a "port already in use" loop.

Debug

Screens

3306

Screenshot 2022-04-18 at 21 42 46

1234

Screenshot 2022-04-18 at 21 43 14

9876

Screenshot 2022-04-18 at 21 43 33

Reproduction

Command I checked with

netstat -p tcp -van | grep '^Proto\|LISTEN' | grep -E "\*\.(3306|1234|9876|80)\s" --color

Screenshot 2022-04-18 at 21 50 07

Port 80 is only in the list, to verify the command works as expected

tpetry commented 2 years ago

I had similar problems in the past too. Docker was not able to bind to ports even if they are free. Only restarting the docker daemon helped. I will have to research that issue further.

tpetry commented 2 years ago

I am able to reproduce this error sporadically. Sometimes it's happening, sometimes not. But by debugging all information, I can guarantee that docker is instructed to use the new port. Although sporadically, it's using the old port...

jason-nabooki commented 2 years ago

I ran into this issue about 3 or 4 times today. Each time the only thing I could do was delete the container from Docker App and start again.

I was trying to pinpoint a specific MySQL 8 bug so I was constantly stopping the DB in Stackbicks, changing the version and then clicking start again.

So not sure if changing the version will help replicate the issue or if it's just sporadic from starting/stopping.

tpetry commented 2 years ago

Hmm, it's strange. Because I am not able to reproduce it anymore for quite some time. I will write a test script in the next days for anyone having the problem to generate some debugging information for me.

Can you try next time not deleting the container but restarting docker and seeing if everything works again? Because when I had the problem, it was always docker not releasing the port. Which could be valid in your case too, as deleting the container may trigger some logic to really finally release the port.

jason-nabooki commented 2 years ago

Sure. I'll have a play with it again on Monday when I'm back at work and report back.

One other thing to note, once I'd finished my investigation I updated my docker app (OSX). So it's also possible that it was an issue with an older version of docker.

jason-nabooki commented 2 years ago

Had a play again to see if I could replicate the port issue. I was able to trigger the "port already in use" error but I think that was genuine as I tried to start it a bit too quickly after it stopped. I waited a few seconds and it was OK to start again.

--

Change by @tpetry: Removed other bug details because it has been reposted as #22.

tpetry commented 2 years ago

@jason-nabooki Please create a new issue for the other problem to make following the issue easier.