appsody / controller

Appsody controller running in the development container. This repo will be archived soon.
https://appsody.dev
Apache License 2.0
2 stars 12 forks source link

Investigation into ON_CHANGE actions during nodejs-express APPSODY_PREP #44

Open kewegner opened 5 years ago

kewegner commented 5 years ago

Description: In some cases, particularly with appsody run for a clean docker for desktop install on Mac Os or when doing:

appsody init-nodejs-express appsody run The first time in a new directory on the Che-emulator environment

We will see:

[Container] Running APPSODY_PREP command: npm install --prefix user-app && npm audit fix --prefix user-app File watch event detected for: FILE "test.js" REMOVE [/project/user-app/test/test.js] File watch event detected for: FILE "test.js" CREATE [/project/user-app/test/test.js]

It appears that something in the npm commands may cause the watcher to think there is no test.js file (and due to the 1 event per watcher cycle setting we use, it could be more than just test.js)

FYI: The watcher.go code uses filepath.walk() routine to construct a map of files and then compares the map previously obtained on the poll to the current poll's map.

One short term fix that was tested for this would be to run APPSODY_PREP serially before starting the watcher, note this was brought up in another issue, whether we should watch during APPSODY_PREP.

Longer term, we need to investigate why the watcher/commands exhibit this behavior.

It did not appear to happen with Java Microprofile in the che emulator environment.

It seems to happen with nodejs-express on MacOS when there is a clean docker environment every time with the first appsody run. It has been seen a couple of times after long disuse of appsody init/followed by appsody run.

Note that subsequent appsody run's do not see the behavior.

kewegner commented 5 years ago

For future investigation: We may want to observe if the PREP command (in the one particular circumstance with npm install) locks files or directories, which might cause the filepath.Walk used by the watcher.go code to skip over particular file(s), and thus it would appear that it was removed, and then re-added on the next polling scan.

neeraj-laad commented 4 years ago

We believe there is no impact to the user, but still needs some investigation.

kewegner commented 4 years ago

Note: If we do #34 It is likely this problem will disappear. It was only happening for node on APPSODY_PREP calls.

kewegner commented 4 years ago

Update #34 is now in PR #58 scheduled for milestone 12. When I run with a clean docker install (2.1.0.5) I do not see any ON_CHANGE actions during PREP for nodejs-express.