mbucc / shmig

Database migration tool written in BASH.
BSD 3-Clause "New" or "Revised" License
458 stars 49 forks source link

Endless loop in latest #36

Closed synchrone closed 5 years ago

synchrone commented 6 years ago

Docker container mkbucc/shmig:latest hangs in an endless loop, consuming 100% CPU (one core) after printing shmig: creating migrations table: shmig_version.

The only difference is https://github.com/mbucc/shmig/commit/0ef361297118f4c13c416eee244f268c28367259.

The issue is not present in mkbucc/shmig:verbose, which is currently built on 2017-07-24T11:48:19.724Z, and does not have this shebang patch applied.

mbucc commented 6 years ago

Wow.

@silenius I'm going to need to roll your patch back until I figure out what is going on here.

synchrone commented 6 years ago

@mbucc can you also trigger a rebuild in https://hub.docker.com/r/mkbucc/shmig/ ?

mbucc commented 6 years ago

@synchrone Sure. Can you give me a test case so I can duplicate this bad behavior?

synchrone commented 6 years ago

sure:

docker-compose.yml

version: '2.1'

services:

  postgres:
    image: kartoza/postgis
    environment:
      - ALLOW_IP_RANGE=0.0.0.0/0
    ports: ['5452:5432']

  migrations:
    image: mkbucc/shmig:latest
    restart: on-failure
    volumes:
      - ./migrations:/sql
    environment:
      - TYPE=postgresql
      - HOST=postgres
      - PORT=5432
      - DATABASE=gis
      - LOGIN=docker
      - PASSWORD=docker
      - UP_MARK=SHMIG
    command: up

migrations/1509357658-init.sql

-- SHMIG

create extension if not exists postgis;

create type kind as enum ('type1');

create table mytable(
    id int primary key
);

run docker-compose up and after several restarts due to postgres starting up, it should hang for good.

mbucc commented 5 years ago

FYI, I tried to duplicate the bug using your instructions way back when, but was not able to.

synchrone commented 5 years ago

I cannot reproduce right now (on latest) either. I suppose this can be closed.