Hi,
I'm testing with valgrind and also shows a use after free because of a race:
1. Thread A: Start handling slot
2. Thread B: Check timeouts, mark for removal
3. Thread C: Picks up the removal, removes it
4. Thread A: Uses it.
The problem seems to be that the mark for removal (close) is launched even if the epoll is marked EPOLLONESHOT, maybe because it is another kind of event.
Still working on it.
David
Alexander
--
You received this message because you are subscribed to the Google Groups "onion-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to onion-dev+...@coralbits.com.
To post to this group, send email to onio...@coralbits.com.
Visit this group at https://groups.google.com/a/coralbits.com/group/onion-dev/.
For more options, visit https://groups.google.com/a/coralbits.com/d/optout.
Don't we currently use a thread pool? Do you mean something else?
Luckily, for now approach #1 works well (with the patch I posted), even
if precisely because libonion uses the maybe-fragile approach of
lock-free sharing of an epoll instance, relying heavily on the one-shot
property. Essentially, this property of epoll distributes work between
the threads much like the ring buffer(s) would, saving the need to
implement those. (But this only works for small responses that are
expected to fit in the kernel's socket write buffers, as well as be
within TCP window size.)