Description
Symfony version(s) affected: 4.1-beta1, master
Description
I started using Symfony with ReactPHP and discovered rather unusual behavior. While requests were lightning fast the profiler was more and more upset with each request.
How to reproduce
- Create kernel
- Reboot kernel
- Handle request
- Terminate kernel
- Go to step 2
Possible Solution
I started digging and apparently \Symfony\Component\HttpKernel\DataCollector\TimeDataCollector
calculates times based on Kernel::getStartTime()
with fallback to request start time. While this approach works when kernel is created and destroyed during the request rebooting kernel doesn't cause TimeDataCollector
to reflect the rebooted kernel state.
Workaround is simple - overwriting reboot()
. However I think we should fix this in abstract kernel by calling $this->startTime = microtime(true);
in reboot()
just before boot()
like so:
public function reboot($warmupDir)
{
$this->shutdown();
$this->warmupDir = $warmupDir;
if ($this->debug) {
$this->startTime = microtime(true);
}
$this->boot();
}
WDYT?