Jump to content

Probles with Tracy + RockFrontend livereload


bernhard
 Share

Recommended Posts

Hey @adrian I get the following error when using Tracy with RockFrontend's live reload feature:

Failed to init module: TracyDebugger - Tracy\DeferredContent::sendAssets() called after some output has been sent. Output started at /var/www/html/site/modules/RockFrontend/LiveReload.php:147.

This is the line in question: https://github.com/baumrock/RockFrontend/blob/5f6c822f2f561f7b0d90d46e05eb66d2964d7dbd/LiveReload.php#L147

This is how I'm loading the livereload class: https://github.com/baumrock/RockFrontend/blob/5f6c822f2f561f7b0d90d46e05eb66d2964d7dbd/RockFrontend.module.php#L122-L131

It needs to be loaded before session start. I guess Tracy does not like that ? Any ideas how to fix this? Can I somehow tell Tracy not to load for that requests?

Link to comment
Share on other sites

56 minutes ago, adrian said:

I am not certain, but I am curious if it helps if SessionHandlerDB is running.

Thx, it has already been running all the time ? Just tried without it and same issue.

What about adding a $config->noTracy = true config setting that makes sure that tracy is not loaded if the flag is true? I could maybe set that on runtime and it could also be nice to have on production servers maybe?

Link to comment
Share on other sites

  • 2 weeks later...

Hey Adrian I'm working on another SSE feature and got an error from Tracy invoking the class destructor:

Quote

Warning: Attempt to read property "post" on null in /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/TracyDebugger.module.php on line 2985
Warning: Attempt to read property "tracyPwVersion" on null in /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/TracyDebugger.module.php on line 2985

Adding this on top of the method fixes it for me:

if (!$this->wire('input')) return;

Not sure if that could have any side-effects? If not, could you please add that check in __destruct ?

Link to comment
Share on other sites

Hey @adrian I'm using SSE in another module as well (it's so great 🙂 ). There I also hook before Session::init and then disable tracy:


  public function __construct()
  {
    if ($this->wire->config->ajax) return;
    if (!array_key_exists(self::getParam, $_GET)) return;
    $this->addHookBefore("Session::init", function (HookEvent $event) {
      $event->wire->config->tracy = ['enabled' => false];
      $event->object->sessionAllow = false;
      $this->liveLog();
    });
  }

It's the same principle as with RockFrontend, but it's another self::getParam here as it's another module!

So instead of checking against RockFrontend::getParam - which would obviously not work with this other module - could we disable tracy by default if $config->sessionAllow === FALSE ?

Link to comment
Share on other sites

  • 2 weeks later...

Hey @bernhard - Tracy doesn't need sessions these days unless you have the "Use Native PHP Session" option checked, so it seems like a strange reason to disable it.

I wonder if something here: https://github.com/nette/tracy#ajax-and-redirected-requests could be of help?

Maybe I need a minimal test case to see the exact problem.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...