Race condition in document generation.
See original GitHub issueI just started using the PDFKit. The following works after calling “doc.end()”:
// ... doc.end()
setTimeout(() => {
res.download(`www/${fileName}`);
}, 3000);
but this returns an empty file:
// ... doc.end()
res.download(`www/${fileName}`);
It appears that doc.end() is a synchronous function. Am I missing an async call, or is it a race condition on the disk?
If I try to read the file from disk immediately after calling doc.end()
using fs
, I get an empty file then also.
Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
What is a Race Condition? - TechTarget
They occur when two computer program processes, or threads, attempt to access the same resource at the same time and cause problems in...
Read more >Race condition - Wikipedia
In software. A race condition can arise in software when a computer program has multiple code paths that are executing at the same...
Read more >Race conditions and deadlocks - Visual Basic - Microsoft Learn
A race condition occurs when two threads access a shared variable at the same time. The first thread reads the variable, and the...
Read more >Race Conditions and Secure File Operations - Apple Developer
Avoiding Race Conditions. A race condition exists when changes to the order of two or more events can cause a change in behavior....
Read more >Race Condition - HackTricks
Race conditions are vulnerabilities that appear in webs that limit the number of times you can perform an action. A very easy example...
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 Free
Top 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
It is asynchronous:
See also issues #642, #633, #525 and #265
Yes it has PNG images