Henrik Grubbstr?m (Lysator) @ Pike (-) developers forum wrote:
I propose ripping out the call_out() method, so that callouts are ran directly in all cases except for the timeout-case.
Not a good idea:
- Unlimited stack use.
I realised that too. That is a definite downside.
- Potential deadlocks/data inconsistency.
This could be considered a plus. Properly written thread-safe code, should not be vulnerable to this. So turning off the call_out() intermediary could be considered a relatively robust way to check if your regular code is actually deadlock-free and thread-safe.
- No serialization of calls.
Same thing here. It could reorder the calls; then again, if your code is resistant against this, then it has been written in a robust manner.
- No idea of in what context/thread your callback gets called.
Yes, found this out the hard way. Turned out that all of a sudden I had database big_query() calls from within my pgsql local_backend (causing a deadlock, obviously).
Since the cost of having the option to use Promises without call_out() is close to zero this way, I propose to keep this option in. It allows for promises without backend, and for a proper stresstest of one's own code to verify robustness.