bernhard Posted October 11, 2022 Share Posted October 11, 2022 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 More sharing options...
adrian Posted October 11, 2022 Share Posted October 11, 2022 Hi @bernhard - I am not certain, but I am curious if it helps if SessionHandlerDB is running. Not saying that this is the fix, but it might help me to debug and figure out a solution. Link to comment Share on other sites More sharing options...
bernhard Posted October 11, 2022 Author Share Posted October 11, 2022 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 More sharing options...
adrian Posted October 11, 2022 Share Posted October 11, 2022 Sorry, I am confused why not loading Tracy makes sense in this case, but if that's what you want, there is already a setting for that - first option in the config settings. 1 Link to comment Share on other sites More sharing options...
bernhard Posted October 12, 2022 Author Share Posted October 12, 2022 Thx adrian totally forgot about that setting since it's always enabled for me ? Seems to work now and was an easy fix: https://github.com/baumrock/RockFrontend/commit/eafe6b9bf46150101723c5dfa874ce0412dee47e 1 Link to comment Share on other sites More sharing options...
adrian Posted October 12, 2022 Share Posted October 12, 2022 7 hours ago, bernhard said: Seems to work now and was an easy fix Awesome! 1 Link to comment Share on other sites More sharing options...
bernhard Posted October 21, 2022 Author Share Posted October 21, 2022 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 More sharing options...
adrian Posted October 23, 2022 Share Posted October 23, 2022 @bernhard - that check seems like it should be fine, but I am wondering if we should perhaps also add an early exit for RockFrontend - something like these: https://github.com/adrianbj/TracyDebugger/blob/17dbc10717bdda826660166477abb04c192eaf3e/TracyDebugger.module.php#L430-L442 1 Link to comment Share on other sites More sharing options...
bernhard Posted October 23, 2022 Author Share Posted October 23, 2022 I already have this in place: https://github.com/baumrock/RockFrontend/blob/ec26e031d60245a871e1615c1346fdccd726fb7d/RockFrontend.module.php#L126 Not sure if an early exit would be better? You could check if a GET parameter with the name RockFrontend::getParam exists ? Link to comment Share on other sites More sharing options...
bernhard Posted October 26, 2022 Author Share Posted October 26, 2022 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 More sharing options...
adrian Posted November 8, 2022 Share Posted November 8, 2022 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 More sharing options...
bernhard Posted November 8, 2022 Author Share Posted November 8, 2022 29 minutes ago, adrian said: Maybe I need a minimal test case to see the exact problem. I'll try to provide one when I find the time! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now