[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] Scheduler fdset assert patch
From: |
Jonathan Chan |
Subject: |
[Chicken-hackers] Scheduler fdset assert patch |
Date: |
Sat, 4 Jul 2015 19:49:02 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
Hello all,
I was in the IRC channel earlier trying to find out why my program was
failing due to a scheduler assertion about the fdset for poll. This
would happen consistently when I sent SIGINT.
The error looks like:
scheduler.c:51: C_fd_ready: Assertion `fd == C_fdset_set[pos].fd' failed
After looking at the scheduler code, it looks like this happened because
the SIGINT was causing the interrupt handler to be called, which ended
up unblocking some thread to run a signal handler, which caused a
condition variable broadcast. In the end, this made a thread that was
previously blocking on a file descriptor to now block on a mutex.
When create-fdset procedure iterated over the ##sys#fd-list, it skipped
threads in the list who were not blocking on fds while it added those
who were to the fdset using fdset-set. However, it did not remove these
threads from ##sys#fd-list, which resulted in the scheduler throwing an
error because it expected a fd to be in the fdset when it was not there.
I have attached a patch which modifies create-fdset to remove threads
from ##sys#fd-list who are not blocking on an fd, rather than only skip
them. This seems to fix my problem and has not introduced any bizarre
behvaior in the few tests I have run, but hopefully someone who is more
familiar with the scheduler could look it over and see if it fixes the
issue.
Best regards,
--
Jonathan Chan
address@hidden
scheduler-assert.diff
Description: Text document
- [Chicken-hackers] Scheduler fdset assert patch,
Jonathan Chan <=
- Re: [Chicken-hackers] Scheduler fdset assert patch, Jonathan Chan, 2015/07/08
- Re: [Chicken-hackers] Scheduler fdset assert patch, Jonathan Chan, 2015/07/08
- Re: [Chicken-hackers] Scheduler fdset assert patch, Jonathan Chan, 2015/07/09
- Re: [Chicken-hackers] Scheduler fdset assert patch, Jonathan Chan, 2015/07/09
- Re: [Chicken-hackers] Scheduler fdset assert patch, Jonathan Chan, 2015/07/10
- Re: [Chicken-hackers] Scheduler fdset assert patch, Peter Bex, 2015/07/11
- Re: [Chicken-hackers] Scheduler fdset assert patch, Jonathan Chan, 2015/07/14
- Re: [Chicken-hackers] Scheduler fdset assert patch, Peter Bex, 2015/07/14
- Re: [Chicken-hackers] Scheduler fdset assert patch, Jonathan Chan, 2015/07/14
- Re: [Chicken-hackers] Scheduler fdset assert patch, Arthur Maciel, 2015/07/14