Vaadin 24.4.12 Building on windows takes over an hour, mac m2 les than a minute

When I try to run the vaadinBuildFronteend gradle task in productionMode, the tasks takes hours to run on my Windows computer, I switch to my Mac and was surprised i takes less than a minute.

I used proccess explorer to figure out what it was stuck on and it appears to be stuck on running “node node_modules\@vaadin\hilla-generator-cli\bin\index.js -o C:\Users\Duncan\IdeaProjects\Project-Unity-work\src\main\frontend\generated -p @vaadin/hilla-generator-plugin-backbone -p @vaadin/hilla-generator-plugin-client -p @vaadin/hilla-generator-plugin-barrel -p @vaadin/hilla-generator-plugin-model -p @vaadin/hilla-generator-plugin-push -p @vaadin/hilla-generator-plugin-subtypes

Running it manually i get this error:

DEBUG (tsgen): Processing OpenAPI
undefined:1


SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Generator.process (file:///C:/Users/Duncan/IdeaProjects/Project-Unity-work/node_modules/@vaadin/hilla-generator-core/Generator.js:19:48)
    at file:///C:/Users/Duncan/IdeaProjects/Project-Unity-work/node_modules/@vaadin/hilla-generator-cli/index.js:50:31

Node.js v20.17.0

I’m trying to figure out how to resolve this, I can run the project fine with productionMode disabled, but when it’s enabled it get’s stuck on Windows. I have tried reinstalling NPM, clearing Gradle caches, switching to pnpm, Vaadin Dance, …, but nothing seems to change anything.

I’m new to React and Vaadin, some notes about the project, it’s written in Kotlin, but the generated classes work fine.

Any help and suggestion would be highly appreciated, I’ll try to make replication project if needed later during the weekend.

Some difference is expected due to how Windows struggles with lots of small files. But the difference shouldn’t be that big even if your Windows machine has a spinning HDD.

One thing you could check for is if some kind of antivirus solution is interfering. You can try this by configuring your antivirus software (or Windows Defender if you haven’t installed anything on your own) to ignore the project directory.

I am using Windows 11, and typical Hilla build times with my demo project is few minutes, so if build takes on hour there is something abnormal. My project is however fairly small.

My project is also small, other projects build fine, my guesse is there’s something causing the process to hang.

Does it eventually complete or does it seem like it keeps running forever? Does the process seem to use any CPU or I/O capacity at all or is just idle?

Just idle node is running with 0 cpu usage and no memory changes. Always on the mentioned process.

Did you try running the build with debug logging to see if there’s any hints there? I don’t remember how to do that with Gradle but with Maven it’s the -X flag.

It can perhaps be related to TaskCopyLocalFrontendFiles#copyLocalResources(File, File, String... ) takes a long time using Windows-OS · Issue #19866 · vaadin/flow · GitHub

You can try to set the vaadin.frontend.disableWritableFlagCheckOnCopy system property when building for production (-Dvaadin.frontend.disableWritableFlagCheckOnCopy=true) and see if it helps.

Hi

I tried this, but again gets stuck waiting for this node task:
afbeelding
I guess it silently fails and causes an infinitely wait.

2024-09-17T17:03:22.166+0200 [DEBUG] [com.vaadin.hilla.parser.core.Parser] Search for endpoints in directories [C:\Users\Duncan\IdeaProjects\Project-Unity-work\build\classes\java\main, C:\Users\Duncan\IdeaProjects\Project-Unity-work\build\resources\main, C:\Users\Duncan\IdeaProjects\Project-Unity-work\build\tmp\kapt3\classes\main, C:\Users\Duncan\IdeaProjects\Project-Unity-work\build\classes\kotlin\main]
2024-09-17T17:03:22.421+0200 [DEBUG] [com.vaadin.hilla.parser.core.Parser] JVM Parser finished successfully
2024-09-17T17:03:22.501+0200 [DEBUG] [com.vaadin.hilla.engine.ParserProcessor] OpenAPI definition file saved
2024-09-17T17:03:22.507+0200 [DEBUG] [com.vaadin.hilla.engine.GeneratorShellRunner] Testing command C:\Program Files\nodejs\node.exe with arguments [-v]
2024-09-17T17:03:22.628+0200 [DEBUG] [com.vaadin.hilla.engine.GeneratorShellRunner] Running command C:\Program Files\nodejs\node.exe

These are the last debug logs after this it’s just logs of de deamon spiting out cache locks en unlocks…

Did you try to run the node command in the screenshot directly from the command line to see if you can get some additional info?

See my first post. Where I ran it manually

Sorry, missed that part

Can you check the contents of the hilla-openapi.json file in the build directory?

The node command receives its content as STDIN.
So when the command you run should be like node node_modules\@vaadin\hilla-generator-cli\bin\index.js ..... p @vaadin/hilla-generator-plugin-subtypes < target/hilla-openapi.json

(I’m not a Window user, so I’m not sure the STDIN redirection works the same)

I was able to debug gradle and get into the GeneratorShellRunner and found no other parameters are added but the ones I provided.

I also found the file location now.

Look at the when the generator run is executed. In the callback the json file is read and written to the stdin

It seems the buff is just empty even though the file exists and is not empty

I debugged this on MAC and there the buffer is indeed not empty

Afer that it goes into proccess.waitFor() and gets stuck.

I debugged if I could read the file and this is the case:

It seems something is going wrong with the copy it seems.

Yes, it seems so. I was looking for known issues but could not find anything related at the moment