DCHECK on reentrant invocations of loop()
authorAlexey Spiridonov <lesha@fb.com>
Sat, 11 Jun 2016 02:12:36 +0000 (19:12 -0700)
committerFacebook Github Bot 4 <facebook-github-bot-4-bot@fb.com>
Sat, 11 Jun 2016 02:23:41 +0000 (19:23 -0700)
commit0806af8f1b68c3f5c75f6330218f49365f53d695
tree297796675a0e78e35aaaeec0615b4bb08c71dbb7
parent52155e1d78650fd0360104f70df987dceed06cb2
DCHECK on reentrant invocations of loop()

Summary:
I had a crash bug where an `EventBase` handler called a function, which tried to use the thread's EventBase as if it were its own:

```
auto evb = folly::EventBaseManager::get()->getEventBase();
// schedule work on evb, which calls evb->terminateLoopSoon() on completion
evb->loopForever();
```

This ended up invoking the `event_base_loop()` reentrantly, and corrupting the heap in a hard-to-debug way.

Reviewed By: djwatson

Differential Revision: D3408155

fbshipit-source-id: b8855aa3b390fa33e032ab295d386122d2cb872a
folly/io/async/EventBase.cpp
folly/io/async/EventBase.h