Comments (5)
I'd like to work on this.
You can assign it to me.
from headlamp.
Yes, I was able to reproduce the issue.
"I was wondering about was that we always copy a certain file last. For example the package.json file"
Right, right, this is what I was talking about.
I'll take a look at atomic moves.
from headlamp.
A naive solution could be sleep-and-retry ( we can have a config for sleeptime and max_no_of_retries )
The issue with the above approach is that even after dist/main.js and package.json are copied, there could be files inside dist/ that are still in progress.
But upon looking at the code in headlamp-plugin.js (ss below), I found out that FileManagerPlugin performs actions sequentially, so package.json is copied only after the entire dist/ dir is copied. I did some research, and it does not leverage any multi-threading.
We can do sleep-and-retry for package.json , if it is found, main.js is expected to be found on the first try (unless there is some other error). Config values tbd on a worst-case basis.
This is not perfect. There could be a case where the dist/ dir is larger than expected, and the worst-case sleeptime value we assumed is not sufficient.
Also, if we set a high sleeptime, assuming the worst case, we will unnecessarily be stalling for lightweight plugins.
To avoid this, we can have incremental sleep time. Instead of 10s of sleep for 3 retries, we can have 2, 10, 20s of sleep before each try.
from headlamp.
The above asynchronous polling style approach, tho it is easy to implement, has some drawbacks.
@illume , any thoughts on this ?
Another solution could be sending a synchronous signal from headlamp-plugin.js to plugins.go after copying files.
We can send an ACK/NACK packet on a particular port and receive it on the other end. This is somewhat complex.
from headlamp.
Thanks for looking into this @HariCharan-001
I wonder did you manage to reproduce the issue yourself?
It would be a pity if we have to introduce a sleep all the time if we don't need to. This delays the page reload a bit. But this could be a solution if nothing else can be found.
I was wondering about was that we always copy a certain file last. For example the package.json file. Then watch on this package.json file in the backend. Since we know it will always be last, this is the one to watch.
Additionally, the files could be first produced in a tmp folder, and then moved atomically. This would stop one race condition from happening. Instead of the backend watch noticing a file and write then it would just see moves, which should happen atomically (and instantly according to the backend file watcher).
As an aside, I saw this page on atomic moves of folders. https://stackoverflow.com/questions/307437/moving-a-directory-atomically I'm not sure how portable things are on Mac / Windows though.
from headlamp.
Related Issues (20)
- Trying to build headlamp for openSUSE: conflict with plugin react HOT 12
- @babel/plugin-proposal-private-property-in-object dependency not declared explicitely HOT 1
- values.yaml is missing an exact example of how to use the ingress HOT 2
- Plugins endlessly reloading on dev only app HOT 1
- Helm charts: Add template testing
- Option to pass Cluster Settings via Config for user Groups HOT 1
- Playwright local fails default
- Certificate handling with k3d
- Proxy Support HOT 2
- Empty X-Forwarded-Host header HOT 1
- Add more info to containers HOT 2
- Storybook fails in a new plugin
- [RFE] Headlamp demo website and branch previews
- headlamp helm chart should be signed
- Clicking Save & Apply in Plugin page opens browser HOT 1
- Update deprecated packages HOT 1
- Helm chart OIDC config with existing secret not working as expected HOT 7
- Websocket Connections resuliting in Forbidden HOT 4
- Headlamp crashes on network tab HOT 2
- Delete a CRD doesn't work HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from headlamp.