go-aah / aah

A secure, flexible, rapid Go web framework
https://aahframework.org
MIT License
690 stars 33 forks source link

Hot reload does not detect changes #215

Closed vcraescu closed 5 years ago

vcraescu commented 5 years ago

Hi,

I'm using a docker image to fire up aah framework https://hub.docker.com/_/golang/ but hot reload not always detect the changes. This is my Dockerfile:

FROM golang:1.11

RUN go get -u aahframework.org/tools.v0/aah

WORKDIR /go/src/github.com/foobar/foobar
COPY . .

RUN go get -d -v ./...
RUN go install -v ./... || true

CMD ["aah", "run"]

This is very frustrating and I can't figure out why is that happening. Makes developing a cumbersome especially when I do some refactoring cause I don't know If I did broke something or just the old code running. I have to restart the container from time to time to be sure I'm running the latest changes.

I'm using aah version 0.11 on a Linux machine:

Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.11
 Git commit:        e68fc7a215
 Built:             Fri Sep  7 11:26:59 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.11
  Git commit:       e68fc7a215
  Built:            Fri Sep  7 11:26:11 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Thanks!

DiliBau commented 5 years ago

👍 can confirm this happens to be both in a container and when running directly on my machine, same docker versions and same go versions as @vcraescu running on Manjaro linux

jeevatkm commented 5 years ago

@vcraescu @DiliBau Thank you for reporting an issue. I will look into it.

Did you observed any pattern or behavior or steps around hotreload to replicate the issue?

Also could you share your holreloqd config from file aah.project?

vcraescu commented 5 years ago

@jeevatkm This config?

hot_reload {
  # Default value is `true`.
  enable = true

  # Watch configuration - files/directories exclusion list.
  #
  # For valid pattern syntax, refer to https://golang.org/pkg/path/filepath/#Match
  watch {
    # Note: static directory is not required to be monitored since aah server
    # delivers up-to-date file on environment profile `dev`.
    dir_excludes = [".*", "sessions"]

    file_excludes = [".*", "_test.go", "LICENSE", "README.md"]
  }
}

I believe it's the default one.

I didn't notice a pattern, just sometimes it stops detecting the changes and I have to stop/start aah run to make it work.

jeevatkm commented 5 years ago

Yes this is the config. Thanks.

Okay so it stops detecting changes after a while.

jeevatkm commented 5 years ago

@vcraescu Update: Last night I was analyzing and trying to find the root cause. As of now no luck. One way I could think of is to update/optimize the file change detect logic in the aah CLI (upcoming release).

vcraescu commented 5 years ago

But did you manage to reproduce the issue? I switched to OSX and I can reproduce the issue there too.

jeevatkm commented 5 years ago

@vcraescu I was able to reproduce the scenario of "hot reload reflects the changes on second refresh" it happened many iteration of change detection(s). That's why I thought update the hot reload flow and handling.

vcraescu commented 5 years ago

Thanks for taking time to fix this. 👍 I will wait 0.12 version.

jeevatkm commented 5 years ago

Applied fix as well as improvements.