wingo / fibers

Concurrent ML-like concurrency for Guile
GNU Lesser General Public License v3.0
309 stars 32 forks source link

Infinite loops on uncaught exceptions #58

Open cwebber opened 2 years ago

cwebber commented 2 years ago

In switching guile-goblins from Fibers 1.0 to 1.10, I noticed that when exceptions occured, schedulers suddenly stopped working but also my cpu would shoot up to 100%. That's strange, that shouldn't happen, what gives?

I did a git-bisect against fibers to try to figure out where this started. The issue is introduced in 84addfbfc69e7dea63c4b9b08656d052043bcecf. I haven't checked for sure, but I'm pretty certain that what's happening is that where the scheduler previously was catching the exception in the individual task but the scheduler would continue looping, now the scheduler is breaking and not continuing on an individual error. Thus, it isn't feeding anything to the individual fibers, which start spin locking madly.

cwebber commented 2 years ago

One option is simply to revert 84addfbfc69e7dea63c4b9b08656d052043bcecf. Maybe @wingo might not like this; it fixes it, but it re-introduces whatever performance issue the commit was meant to address.

aconchillo commented 2 years ago

IMO, stability is always preferred over performance.

wingo commented 2 years ago

Do you have a test case?

aconchillo commented 2 years ago

@cwebber Probably completely unrelated, but I'm wondering if this commit https://github.com/wingo/fibers/commit/c25dcb9cc4b5b977474ffe555b40ce2f1d0d1edc would fix the issue you are seeing. Available in Fibers 1.1.1.

wingo commented 1 year ago

Pretty sure this is fixed via #76, which is now in Guile main. Christine can you give a try with Guile from git and see if you are still having issues? Or otherwise close this one if you think it is fixed.