[Bigfork] kassert failed: !curthread->t_in_interrupt

We are passing almost all of the tests running in the kernel with 1 CPU and 1MB RAM, except bigfork, which I only ran twice because it takes ~forever~, and both times we got this error, like 10 minutes into the test, mind you:

Stage 5 #59 done: 62977821
…panic: Assertion failed: !curthread->t_in_interrupt, at …/…/thread/thread.c:1043 (wchan_sleep)

In thread.c there is a comment that tells us what this assert means:

/* may not sleep in an interrupt handler */

However, I’m having a very difficult time tracking down what in my code could be causing this. Has anybody else wrestled with this issue and, if so, what was it? What are some tips you could give me? Thanks.

It is likely that you’re handling an interrupt while trying to perform a function that wants to you sleep, such as acquiring a different type of synchronization primitive (lock, calling P on semaphore, etc.) or, more likely, memcpy, VOP_READ, or VOP_WRITE. What else is in the backtrace of that assertion failure?

It’s not something I’ve been able to catch to backtrace because 1) Multithreaded debugging is hell and 2) It’s rare and only occurred a few times deep into long tests, so catching it is pretty difficult. I do however call VOP functions in synchronized areas but Im pretty certain that’s expected. Anyway while it’s pretty rare on 1 CPU it’s far more common on 8 so I’m going to keep hacking away because we dont handle tlb_shootdown yet.