question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Race condition after creating files

See original GitHub issue

Copying 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:closed
  • Created 7 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
parkrcommented, Feb 8, 2017

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 via Jekyll::Hooks: http://jekyllrb.com/docs/plugins/#hooks

0reactions
mertkahyaoglucommented, Oct 21, 2017

Closed via #415

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found