Tracy causing random js and css files to not load

5 months ago

quasipickle
Member | 1
+
0
-

Hi,

Randomly – about 50% of page loads, I see about a 5 second delay when loading a page. These delays are always on Javascript or CSS files that don't involve PHP at all. When I look at what was sent from the server in the developer tools, I see the markup for the Tracy Debug Bar, then the expected headers, then some encoded binary garbage. For example, this is the result of my browser's request for “app.js”

<!-- Tracy Debug Bar -->
<script src="?_tracy_bar=js&amp;v=2.5.0&amp;XDEBUG_SESSION_STOP=1" data-id="121f475336"></script>
<script>
Tracy.Debug.init("\t\t<div class=\"tracy-panel \" id=\"tracy-debug-panel-Tracy-info\" data-tracy-content=\"&lt;style class=&quot;tracy-debug&quot;&gt;\n\t#tracy-debug .tracy-InfoPanel td {\n\t\twhite-space: nowrap;\n\t}\n\t#tracy-debug .tracy-InfoPanel td:nth-child(2) {\n\t\tfont-weight: bold;\n\t\twidth: 30%;\n\t}\n\t#tracy-debug .tracy-InfoPanel td[colspan='2'] b {\n\t\tfloat: right;\n\t\tmargin-left: 2em;\n\t}\n&lt;\/style&gt;\n\n&lt;h1&gt;System info&lt;\/h1&gt;\n\n&lt;div class=&quot;tracy-inner tracy-InfoPanel&quot;&gt;\n&lt;div class=&quot;tracy-inner-container&quot;&gt;\n&lt;table&gt;\n&lt;tr&gt;\n\t&lt;td&gt;Execution time&lt;\/td&gt;&lt;td&gt;26.1\u202fms&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n\t&lt;td&gt;CPU usage user + system&lt;\/td&gt;&lt;td&gt;46\u202f% + 0\u202f%&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n\t&lt;td&gt;Peak of allocated memory&lt;\/td&gt;&lt;td&gt;1.09\u202fMB&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n\t&lt;td&gt;Included files&lt;\/td&gt;&lt;td&gt;52&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n\t&lt;td&gt;OPcache&lt;\/td&gt;&lt;td&gt;100% cached&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n\t&lt;td&gt;Classes + interfaces + traits&lt;\/td&gt;&lt;td&gt;27 + 2 + 1&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n\t&lt;td&gt;Your IP&lt;\/td&gt;&lt;td&gt;142.244.29.20&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n\t&lt;td&gt;Server IP&lt;\/td&gt;&lt;td&gt;142.244.26.53&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n\t&lt;td&gt;HTTP method \/ response code&lt;\/td&gt;&lt;td&gt;GET \/ 200&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n\t&lt;td&gt;PHP&lt;\/td&gt;&lt;td&gt;7.0.27-0+deb9u1&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n\t&lt;td&gt;Tracy&lt;\/td&gt;&lt;td&gt;2.5.0&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;tr&gt;\n\t&lt;td&gt;Server&lt;\/td&gt;&lt;td&gt;Apache\/2.4.25 (Debian)&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;\/table&gt;\n\n\t&lt;h2&gt;&lt;a class=&quot;tracy-toggle tracy-collapsed&quot; data-tracy-ref=&quot;^div .tracy-InfoPanel-packages&quot;&gt;Composer Packages (17)&lt;\/a&gt;&lt;\/h2&gt;\n\n\t&lt;div class=&quot;tracy-InfoPanel-packages tracy-collapsed&quot;&gt;\n\t\t&lt;table&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;doctrine\/lexer&lt;\/td&gt;&lt;td&gt;v1.0.1&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;dragonmantank\/cron-expression&lt;\/td&gt;&lt;td&gt;v2.1.0&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;egulias\/email-validator&lt;\/td&gt;&lt;td&gt;2.1.3&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;firebase\/php-jwt&lt;\/td&gt;&lt;td&gt;v5.0.0&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;google\/apiclient&lt;\/td&gt;&lt;td&gt;v2.2.1&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;google\/apiclient-services&lt;\/td&gt;&lt;td&gt;v0.55&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;google\/auth&lt;\/td&gt;&lt;td&gt;v1.3.0&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;guzzlehttp\/guzzle&lt;\/td&gt;&lt;td&gt;6.3.2&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;guzzlehttp\/promises&lt;\/td&gt;&lt;td&gt;v1.3.1&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;guzzlehttp\/psr7&lt;\/td&gt;&lt;td&gt;1.4.2&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;monolog\/monolog&lt;\/td&gt;&lt;td&gt;1.23.0&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;phpseclib\/phpseclib&lt;\/td&gt;&lt;td&gt;2.0.11&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;psr\/cache&lt;\/td&gt;&lt;td&gt;1.0.1&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;psr\/http-message&lt;\/td&gt;&lt;td&gt;1.0.1&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;psr\/log&lt;\/td&gt;&lt;td&gt;1.0.2&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;swiftmailer\/swiftmailer&lt;\/td&gt;&lt;td&gt;v6.0.2&lt;\/td&gt;&lt;\/tr&gt;\n\t\t\t&lt;tr&gt;&lt;td&gt;tecnickcom\/tcpdf&lt;\/td&gt;&lt;td&gt;6.2.17&lt;\/td&gt;&lt;\/tr&gt;\n\t\t&lt;\/table&gt;\n\t\n\t\t&lt;\/div&gt;\n&lt;\/div&gt;\n&lt;\/div&gt;\n\n\n\t&lt;div class=&quot;tracy-icons&quot;&gt;\n\t\t&lt;a href=&quot;#&quot; rel=&quot;window&quot; title=&quot;open in window&quot;&gt;&amp;curren;&lt;\/a&gt;\n\t\t&lt;a href=&quot;#&quot; rel=&quot;close&quot; title=&quot;close window&quot;&gt;&amp;times;&lt;\/a&gt;\n\t&lt;\/div&gt;\n\"><\/div>\t\t<div class=\"tracy-panel \" id=\"tracy-debug-panel-Tracy-errors\" data-tracy-content=\"\"><\/div>\n<div id=\"tracy-debug-bar\">\n\t<ul>\n\t\t<li id=\"tracy-debug-logo\" title=\"Tracy Debugger 2.5.0 \nhttps:\/\/tracy.nette.org\">\n\t\t\t<svg viewBox=\"0 -10 1561 333\"><path fill=\"#585755\" d=\"m176 327h-57v-269h-119v-57h291v57h-115v269zm208-191h114c50 0 47-78 0-78h-114v78zm106-135c17 0 33 2 46 7 75 30 75 144 1 175-13 6-29 8-47 8h-27l132 74v68l-211-128v122h-57v-326h163zm300 57c-5 0-9 3-11 9l-56 156h135l-55-155c-2-7-6-10-13-10zm-86 222l-17 47h-61l102-285c20-56 107-56 126 0l102 285h-61l-17-47h-174zm410 47c-98 0-148-55-148-163v-2c0-107 50-161 149-161h118v57h-133c-26 0-45 8-58 25-12 17-19 44-19 81 0 71 26 106 77 106h133v57h-119zm270-145l-121-181h68l81 130 81-130h68l-121 178v148h-56v-145z\"\/><\/svg>\n\t\t<\/li>\n\t\t\t\t<li><a href=\"#\" rel=\"tracy-debug-panel-Tracy-info\"><span title=\"Execution time\">\n<svg viewBox=\"0 0 2048 2048\"><path fill=\"#86bbf0\" d=\"m640 1153.6v639.3h-256v-639.3z\"\/><path fill=\"#6ba9e6\" d=\"m1024 254.68v1538.2h-256v-1538.2z\"\/><path fill=\"#4f96dc\" d=\"m1408 897.57v894.3h-256v-894.3z\"\/><path fill=\"#3987d4\" d=\"m1792 513.08v1279.8h-256v-1279.8z\"\/>\n<\/svg><span class=\"tracy-label\">26.1\u202fms<\/span>\n<\/span><\/a><\/li>\t\t<li><a href=\"#\" rel=\"close\" title=\"close debug bar\">&times;<\/a><\/li>\n\t<\/ul>\n\n<\/div>", []);
</script>
HTTP/1.1 200 OK
Date: Wed, 06 Jun 2018 21:46:08 GMT
Server: Apache/2.4.25 (Debian)
Last-Modified: Tue, 15 May 2018 19:33:41 GMT
ETag: "13eb-56c43adfabcb7-gzip"
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 2232
Keep-Alive: timeout=5, max=97
Connection: Keep-Alive
Content-Type: application/javascript

[binary type characters I assume is my browser attempting to display the gzipped contents of app.js]

It looks like for some reason, random requests have Tracy inject itself before the actual content.

I'm not 100% sure this is a Tracy problem, but I don't know what else it could be.This doesn't happen every page load – so it's not a server configuration or an invalid url. It doesn't always happen on the same file – but it's always on a Javascript or CSS file that shouldn't involve Tracy at all.

I should also mention this is happening in both Firefox and Chrome – so it's not a particular browser problem either.

Last edited by quasipickle (2018-06-07 00:00)

5 months ago

Ondřej Kubíček
Member | 308
+
0
-

tracy should be loaded only in develop enviroment, not production where it is disabled by default
is it production server? do you have it allowed yourself?

how do you load app.js? it is ordinary js file? there is no server script which provide this js? if not, there is no way how could be tracy “load” to this js file because tracy is invoke by nette, so you somewhere run nette