Race condition after creating files
See original GitHub issueCopying from #281
I’ve encountered an issue while renaming files over and over again. Sometimes, after writing to the disc, the resulted page/document might be nil which causes 404. As far as I see, this happens randomly. Sometimes it renames and returns the renamed file, sometimes it returns nil.
IMO, this is because site.process
is not actually blocking. Sometimes it takes so much time to finish so that there occurs a race condition which makes newly created files not ready to be served.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
How to prevent a race condition when multiple processes ...
When several processes are run at once, this code causes just one to open and write to pyx_file (assuming pyx_file does not already...
Read more >7.10. Avoid Race Conditions
A ``race condition'' can be defined as ``Anomalous behavior due to unexpected critical dependence on the relative timing of events'' [FOLDOC]. Race conditions...
Read more >Race Conditions and Secure File Operations - Apple Developer
Describes techniques to use and factors to consider to make your code more secure from attack.
Read more >Race Condition: File System Access - Fortify Taxonomy
File access race conditions, known as time-of-check, time-of-use (TOCTOU) race conditions, occur when: 1. The program checks a property of a file, referencing ......
Read more >Safe coding: Race conditions - CGSecurity
The race conditions allow various processes to use the same resource at once (file, device, memory), though each one "believes" it has an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey! So all of Jekyll is blocking, but when you run
jekyll serve
, we boot up two threads: one for the watcher (regenerates your site) and one for the HTTP server. It sounds like the presence of 2 threads is causing the confusion and overlap here.To get around this, I would consider how you can achieve what you’re looking for by hooking into the
site.process
method viaJekyll::Hook
s: http://jekyllrb.com/docs/plugins/#hooksClosed via #415