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

Live reload failing with Zip archives generated by code.quarkus.io due to time zone issues #4064

Closed
emmanuelbernard opened this issue Sep 17, 2019 · 11 comments · Fixed by #4135
Assignees
Labels
area/devmode good first issue Good for newcomers kind/bug Something isn't working
Milestone

Comments

@emmanuelbernard
Copy link
Member

emmanuelbernard commented Sep 17, 2019

on 0.22

  1. Start new project with code.quarkus.io with resteasy,resteasy-jsonb,panache,postgresql,openapi,validator
  2. go in live reload
  3. add TodoResource
@Path("/api")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class TodoResource {
    @GET
    public List<Todo> getAll() {
        return Todo.listAll();
    }
}
  1. add Todo
@Entity
public class Todo extends PanacheEntity {
    public String title;
}
  1. refresh http://localhost:8080/api
  2. see Hibernate not configured error
  3. add in application.properties
# set DB
quarkus.datasource.url=jdbc:postgresql:quarkus-demo
quarkus.datasource.driver=org.postgresql.Driver
quarkus.datasource.username=quarkus-demo
quarkus.datasource.password=quarkus-demo

# Hibernate details
quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.hibernate-orm.log.sql=true
  1. refresh http://localhost:8080/api
  2. You still see the error where it should not and the logs show that the hot reload detects the wrong file change (I did not update ExampleResource.java but application.properties
2019-09-17 07:07:00,034 INFO  [io.qua.dev] (executor-thread-1) Changed source files detected, recompiling [/Users/emmanuel/Code/quarkus/demos/CodeOne/hibernate-app/src/main/java/io/quarkus/hibernate/ExampleResource.java]
2019-09-17 07:07:00,247 INFO  [io.qua.dep.QuarkusAugmentor] (executor-thread-1) Beginning quarkus augmentation

I would love for this exact scenario to be tested in unit tests because it has broken numnerous times in the past.

@emmanuelbernard emmanuelbernard added the kind/bug Something isn't working label Sep 17, 2019
@ia3andy
Copy link
Contributor

ia3andy commented Sep 17, 2019

@emmanuelbernard you can share the link to the generated app.
I think a tiny url feature would be great 😅

@emmanuelbernard
Copy link
Member Author

I confirm that doing the same app with

mvn io.quarkus:quarkus-maven-plugin:0.21.2:create
mvn quarkus:add-extension -Dextensions=jdbc-postgresql,hibernate-orm-panache,hibernate-validator,resteasy-jsonb,openapi

Work as expected so it's either a bug from the code.quarkus.io generator or Quarkus 0.22 or a combination of both.

BTW I don't understand why code. generates ExampleResource while the mvn pluging generates HelloResource,

@emmanuelbernard
Copy link
Member Author

@ia3andy No time, I'm trying to salvage my demos for CodeOne

@emmanuelbernard
Copy link
Member Author

As @gsmet guessed my files have a modified date in the future which must be screwing up things

@emmanuelbernard
Copy link
Member Author

So I'm on macOS and use the code.quarkus.io in SFO. if that helps on the date problem and use the macOS native archive opener

@gsmet
Copy link
Member

gsmet commented Sep 17, 2019

FWIW, the date issue is reproducible on a plain Fedora 30 so I think it's a general issue.

@ia3andy
Copy link
Contributor

ia3andy commented Sep 17, 2019

This issue has been reproduced and seems to be due to the zip creation in Code Quarkus. I filed an issue there: quarkusio/code.quarkus.io#152

Let's keep that issue open until we actually have a fix.

@gsmet gsmet changed the title Regression in live reload mode Live reload failing with Zip archives generated by code.quarkus.io due to time zone issues Sep 17, 2019
@ia3andy
Copy link
Contributor

ia3andy commented Sep 17, 2019

It's now fixed on code.quarkus.io

I think as @maxandersen suggested, maybe it would be better to check the (risky?) files dates at build/runtime?

@emmanuelbernard
Copy link
Member Author

Is it really fixed in the macOS archiver case in the end?

@ia3andy
Copy link
Contributor

ia3andy commented Sep 18, 2019

Is it really fixed in the macOS archiver case in the end?

@emmanuelbernard no it still bug, I'll create a new fix with a fixed date in the past (probably build date UTC - 12h).

As discusses with @dmlloyd and @stuartwdouglas, in parallel, a fix in the quarkus dev watch algo seems important too. They suggested using date offset from the file dates.

@dmlloyd
Copy link
Member

dmlloyd commented Sep 19, 2019

As discusses with @dmlloyd and @stuartwdouglas, in parallel, a fix in the quarkus dev watch algo seems important too. They suggested using date offset from the file dates.

Not date offset: rather, record the dates for each file and compare to see if they've changed (in any way). Don't do arithmetic of any kind on filesystem dates/timestamps or dates/timestamps returned by the JVM - such operations are inherently unreliable in the face of DST, NTP, human error, etc. Just see if it's different or not different than it was before.

@gsmet gsmet added the good first issue Good for newcomers label Sep 19, 2019
@machi1990 machi1990 self-assigned this Sep 20, 2019
machi1990 added a commit to machi1990/quarkus that referenced this issue Sep 20, 2019
…e.quarkus.io due to time zone i

this fixes the issue by implementing a solution proposed by this comment
quarkusio#4064 (comment) and just check if las
recorded time and current modification time are different.
machi1990 added a commit to machi1990/quarkus that referenced this issue Sep 20, 2019
…e.quarkus.io due to time zone issue

this fixes the issue by implementing a solution proposed by this comment
quarkusio#4064 (comment) and just check if last
recorded time and current modification time are different.
machi1990 added a commit to machi1990/quarkus that referenced this issue Sep 20, 2019
…e.quarkus.io due to time zone issue

this fixes the issue by implementing a solution proposed by this comment
quarkusio#4064 (comment) and just check if last
recorded time and current modification time are different.
machi1990 added a commit to machi1990/quarkus that referenced this issue Sep 21, 2019
…e.quarkus.io due to time zone issue

this fixes the issue by implementing a solution proposed by this comment
quarkusio#4064 (comment) and just check if last
recorded time and current modification time are different.
machi1990 added a commit to machi1990/quarkus that referenced this issue Sep 22, 2019
…e.quarkus.io due to time zone issue

this fixes the issue by implementing a solution proposed by this comment
quarkusio#4064 (comment) and just check if last
recorded time and current modification time are different.
machi1990 added a commit to machi1990/quarkus that referenced this issue Sep 23, 2019
…e.quarkus.io due to time zone issue

this fixes the issue by implementing a solution proposed by this comment
quarkusio#4064 (comment) and just check if last
recorded time and current modification time are different.
machi1990 added a commit to machi1990/quarkus that referenced this issue Sep 23, 2019
…e.quarkus.io due to time zone issue

this fixes the issue by implementing a solution proposed by this comment
quarkusio#4064 (comment) and just check if last
recorded time and current modification time are different.
@gsmet gsmet added this to the 0.24.0 milestone Sep 24, 2019
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
…de.quarkus.io due to time zone issue

    this fixes the issue by implementing a solution proposed by this comment
    quarkusio/quarkus#4064 (comment) and just check if last
    recorded time and current modification time are different.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devmode good first issue Good for newcomers kind/bug Something isn't working
Projects
None yet
5 participants