johnstephens Posted January 10, 2022 Share Posted January 10, 2022 Hello! I wondered if anyone knows how to troubleshoot this. I have one specific page where the the Tracy debug bar doesn't load, so I can't access the output of bd() and other Tracy functions. The debug bar does appear in the ProcessWire back-end and every other front-end page I checked. My first thought was that, for some reason, ProcessWire didn't think I was logged in as a superuser on that page, but I echoed $user->name, and it showed my superuser username. For good measure, I also echoed $user->hasPermission('tracy-debugger'), and got the output "1". I checked the TracyDebugger module settings to see if I misconfigured something, and couldn't find anything obviously wrong: "Enable TracyDebugger" is checked. "Output mode" is set to "DEVELOPMENT". "Force superusers" and "guest users into DEVELOPMENT mode" are both unchecked. I checked them and reloaded just in case and got the same behavior. "Show debug bar" is checked for "Frontend" and "Backend". "No debug bar in…" is unchecked for all modes. I'm sure the solution will seem obvious in hindsight, I just can't foresee it. Thanks in advance for any guidance! Link to comment Share on other sites More sharing options...
Zeka Posted January 10, 2022 Share Posted January 10, 2022 Hi @johnstephens Did you check your browser console for errors? 2 Link to comment Share on other sites More sharing options...
johnstephens Posted January 10, 2022 Author Share Posted January 10, 2022 No. No errors in the browser console, nor do I see any errors logged in ProcessWire's error log under "Setup » Logs". For what it's worth, the page does not seem to be loading any front-end scripts at all from TracyDebugger. On other pages where the debug bar loads, I see a huge wodge of markup appended to the markup I wrote, starting with <!-- Tracy Debug Bar -->. The affected page has no appended script elements at all. I see I can make the debug bar appear if I uncomment two lines of code that were throwing a fatal error. Link to comment Share on other sites More sharing options...
adrian Posted January 11, 2022 Share Posted January 11, 2022 19 hours ago, johnstephens said: I see I can make the debug bar appear if I uncomment two lines of code that were throwing a fatal error. I'd be interested to see that code to see if there is something I can do to prevent Tracey from not capturing that error and breaking it from loading. 1 Link to comment Share on other sites More sharing options...
johnstephens Posted January 11, 2022 Author Share Posted January 11, 2022 I'm willing to share it, but I don't know how much would be useful. I started with something like this: This problem of TracyDebugger failing to load came up after adding code to compose the site's parent/child hierarchy using the imported articles. The specific lines that throw the fatal error are these: $newArticle->alert->setLanguageValue($en, $article['alert_en']); $newArticle->alert->setLanguageValue($es, $article['alert_es']); When those lines are included, Tracy's debug bar loads and shows me the stack trace of the error. The reported error is "Call to a member function setLanguageValue() on null", which doesn't make sense to me. I verified that the 'alert' field is attached to the template AND that it's correctly configured as a multi-language textarea (as opposed to a regular textarea, which wouldn't support the setLanguageValue() method). I commented out those lines to simply dump the $newArticle object using bd(), and the actual script executes without any errors or warnings—but then Tracy's debug bar vanishes. I wonder what could stop the debug bar from loading? I hope this helps. Thank you, @adrian! Link to comment Share on other sites More sharing options...
johnstephens Posted January 19, 2022 Author Share Posted January 19, 2022 I've done a lot of testing, and my hunch is that the script is running out of memory—specifically when I invoke bd(). What I'm doing is this: Query a MySQL database with $database->query(). Use foreach to loop through the results. Each iteration of the loop, I select a $parent page based on data from the query and create a new page with $pages->add(). If I invoke bd() within the loop, TracyDebugger fails to load. If I don't invoke bd() in the loop, the debug bar loads. Link to comment Share on other sites More sharing options...
adrian Posted January 20, 2022 Share Posted January 20, 2022 Hi @johnstephens - thanks for looking into it further - sorry I didn't respond to your last message - I didn't really see anything I could use to reproduce it. It does sound like you might be onto something with the memory error idea. I am curious what is in your bd() call - are there a lot or heavy objects being dumped? How many results are you looping through? If I try to dump too many items, eg: for($i=0;$i<99999999;$i++) { bd($i); } And I do get an out of memory fatal error and the debug bar fails to load, but I fixed it by increasing the "Reversed memory size" option in Tracy's config settings. Please let me know if that works for you. 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