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

bind: address already in use #265

Open
2 tasks done
eliabieri opened this issue Feb 20, 2024 · 2 comments
Open
2 tasks done

bind: address already in use #265

eliabieri opened this issue Feb 20, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@eliabieri
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

supabase start fails randomly due to a port already being in use. It seems to be a timing issue as it only happens every other time when running the Github Action below.

This is the error generated:

Digest: sha256:48d2fabef1b0b1e8f9b208518008686a1cd336503af4fd6f62e169268ed9066e
Status: Downloaded newer image for ghcr.io/supabase/postgres:15.1.0.137
failed to start docker container: Error response from daemon: driver failed programming external connectivity on endpoint supabase_db_jobmate (8a76852f7f3f62ebe3fbd7ebf9cff92182749ee130513dc2b2c51d2b672a422c): Error starting userland proxy: listen tcp4 0.0.0.0:54322: bind: address already in use
Try rerunning the command with --debug to troubleshoot the error.

To Reproduce

  1. Create a Github Action
name: "Push migrations"
on:
  push:
    branches:
      - main

jobs:
  test:
    runs-on: ubuntu-latest

    permissions:
      # Required to checkout the code
      contents: read
    env:
      SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4
      - uses: supabase/setup-cli@v1
      - name: Link Supabase project
        run: supabase link --project-ref ${{ vars.SUPABASE_PROJECT_ID }} --password ${{ secrets.SUPABASE_DB_PASSWORD }}
      - name: Start Supabase
        run: supabase start
      - name: Push migrations
        run: supabase db push --password ${{ secrets.SUPABASE_DB_PASSWORD }}
  1. Run the action

Expected behavior

I expect this action to run successfully every time.

Full logs

5_Start Supabase.txt

@eliabieri eliabieri added the bug Something isn't working label Feb 20, 2024
@elyobo
Copy link

elyobo commented Sep 14, 2024

This is intermittent but common for us. I don't think it's every other time, it will often fail many times in a row, but it does sometimes succeed.

@elyobo
Copy link

elyobo commented Sep 22, 2024

I've made some tweaks on the assumption that this is GHA keeping a "hot" function around to run the workflows, and so docker's already running and messing with things. None of this is robustly tested across test failures or concurrent workflows from other branches.

Try to start up more carefully

      - name: start or reset supabase db server
        run: |
          set +e
          supabase status
          if [ $? -eq 0 ]; then
            echo "Supabase is already running, resetting database..."
            supabase db reset
          else
            echo "Supabase is not running, starting database..."
            supabase db start
          fi
          set -e

Try to clean up by stopping supabase afterwads even in cases of test failures

      - name: cleanup supabase db service
        if: always()
        run: npx supabase stop

and also limit concurrency

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants