5 ms·
"You're too stupid to handle this, just stick to PHP" - really? If a developer can't grasp Node well enough to avoid blocking the event loop, I certainly would
by LewisJEllis 12y ago
"You're too stupid to handle this, just stick to PHP" - really?
If a developer can't grasp Node well enough to avoid blocking the event loop, I certainly wouldn't want them trying to handle a thousand connected clients with PHP!
Anyway, to answer your question - within a single node process no, not really. If something on the event loop goes into an infinite loop, timeouts will be of no use, and all other open requests are gonna be toast. This is just a downside to cooperative multitasking.
- XorNot 12y agoSeriously. Blocking the event loop isn't "an accident that can happen" in node - it's a pretty fundamental mistake.
- esailija 12y agoUsing any CPU is a fundamental mistake?
- nilliams 12y agoPeople are talking about accidentally blocking the event-loop, e.g. accidentally creating an infinite loop, not 'using any CPU'.
- MichaelGG 12y agoExcept they don't have the normal option available to them that event loop systems do: start another thread.
- madawan 12y agoSome problems might be easier to solve in one language than in another. If you can't solve quicksort in ASM, does that mean people would be correct in wanting to refrain you from solving it in Python? It's a bit grotesque but completely analogous to your objection. It is the opinion of many that cooperative multitasking is not the way to go if you want to solve problems which require massive concurrency. PS: In Racket, you could defend against threads going into infinite loops with custodians. http://docs.racket-lang.org/more/#%28part._.Terminating_.Connections%29 http://docs.racket-lang.org/more/#%28part._.Terminating_.Con...