Comments (20)
Hmm, the reading/processing lines shouldn't have been sent to the browser - sounds like output from Devel::NYTProf itself getting passed through wrongly. Are you saying the links to the run results didn't work themselves?
from dancer-plugin-nytprof.
The /nytprof page is not displayed as an HTML file, more like a text file that happens to contain "raw" HTML tags and HTTP headers (so the links are not shown as clickable links, just as raw "a" tags). Looks to me like output from Devel::NYTProf is sent to the browser before the headers etc, causing my browser to not interpret it as HTML.
If I empty out the "profdir" (so there is no data to display) and look at /nytprof, I get a nice HTML page, that says:
Profile run list
Select a profile run output from the list to view the HTML reports as produced by Devel::NYTProf.
Generated by Dancer::Plugin::NYTProf v0.31
After I view a couple of pages and go back to /nytprof I get a page similar to the one i reported above. Console output when doing this looks like:
[28710] core @0.000171> request: GET /nytprof from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 56
[28710] core @0.000715> [hit #33]Trying to match 'GET /nytprof' against /^/logout$/ (generated from '/logout') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 84
[28710] core @0.000905> [hit #33]Trying to match 'GET /nytprof' against /^/nytprof$/ (generated from '/nytprof') in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 84
[28710] core @0.001059> [hit #33] --> got 1 in /usr/local/share/perl/5.14.2/Dancer/Route.pm l. 102
[28710] core @0.001322> [hit #33]entering before hook in /usr/local/share/perl/5.14.2/Dancer/Hook.pm l. 58
[28710] core @0.001534> [hit #33]entering before hook in /usr/local/share/perl/5.14.2/Dancer/Hook.pm l. 58
Eval '(eval 1085)[/usr/share/perl5/YAML.pm:82]' (fid 3, flags:viastmt,hassrc,savesrc) has unknown invoking fid 4
Eval '(eval 992)[/usr/local/share/perl/5.14.2/Class/Accessor/Grouped.pm:807]' (fid 7, flags:viastmt,hassrc,savesrc) has unknown invoking fid 8
Eval '(eval 1092)[/usr/share/perl/5.14/base.pm:90]' (fid 55, flags:viastmt,hassrc,savesrc) has unknown invoking fid 56
[28710] core @0.228335> [hit #33]entering after hook in /usr/local/share/perl/5.14.2/Dancer/Hook.pm l. 58
[28710] core @0.228804> [hit #33]response: 200 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 179
[28710] core @0.000187> request: GET /favicon.ico from 127.0.0.1 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 56
[28710] core @0.001077> [hit #34]response: 200 in /usr/local/share/perl/5.14.2/Dancer/Handler.pm l. 179
from dancer-plugin-nytprof.
I understand this is an old bug, but running your plugin still produces this result. The page is being returned as plain text, along with the Reading/Processing lines from Devel::NYTProf.
Secondarily, I can see that links to individual reports are being rendered like this:
<a href="http://192.168.2.201:3000/nytprof/nytprof.out.my_s_home.6058"">my/home</a>
with two double-quotes at the end of the href in the tag. This can cause additional rendering errors, too.
from dancer-plugin-nytprof.
For clarity, this is exactly what I get when I run /nytprof on my dev environment:
Reading /usr/home/badkarma/src/dancer_projects/side7v5/Side7/nytprof/nytprof.out.my_s_home.6058
Processing /usr/home/badkarma/src/dancer_projects/side7v5/Side7/nytprof/nytprof.out.my_s_home.6058 data
Reading /usr/home/badkarma/src/dancer_projects/side7v5/Side7/nytprof/nytprof.out.user_directory.6058
Processing /usr/home/badkarma/src/dancer_projects/side7v5/Side7/nytprof/nytprof.out.user_directory.6058 data
Reading /usr/home/badkarma/src/dancer_projects/side7v5/Side7/nytprof/nytprof.out..6058
Processing /usr/home/badkarma/src/dancer_projects/side7v5/Side7/nytprof/nytprof.out..6058 data
HTTP/1.0 200 OK
Server: Perl Dancer 1.3123
Content-Length: 847
Content-Type: text/html; charset=utf-8
X-Powered-By: Perl Dancer 1.3123
<html><head><title>NYTProf profile run list</title>
<style>
* { font-family: Verdana, Arial, Helvetica, sans-serif; }
</style>
</head>
<body>
<h1>Profile run list</h1>
<p>Select a profile run output from the list to view the HTML reports as
produced by <tt>Devel::NYTProf</tt>.</p>
<ul>
<li><a href="http://192.168.2.201:3000/nytprof/nytprof.out.my_s_home.6058"">my/home</a> (PID 6058, Tue May 20 11:05:42 2014, 0.3899 secs)</li><li><a href="http://192.168.2.201:3000/nytprof/nytprof.out.user_directory.6058"">user_directory</a> (PID 6058, Tue May 20 11:05:37 2014, 2.2647 secs)</li><li><a href="http://192.168.2.201:3000/nytprof/nytprof.out..6058""></a> (PID 6058, Tue May 20 11:05:31 2014, 0.3234 secs)</li></ul>
<p>Generated by <a href="http://github.com/bigpresh/Dancer-Plugin-NYTProf">
Dancer::Plugin::NYTProf</a> v0.31</p>
</body>
</html>
from dancer-plugin-nytprof.
@bigpresh I ran into the same issue recently. The call to Devel::NYTProf::Data->new was outputting to stdout and stderr. This was being sent in the http response body. As a quick fix, I wrapped the call to capture and ignore both.
https://github.com/bigpresh/Dancer-Plugin-NYTProf/blob/0.31/lib/Dancer/Plugin/NYTProf.pm#L166
use Capture::Tiny ':all';
my ($stdout, $stderr, @result) = capture {
$profile = Devel::NYTProf::Data->new({ filename => $fullfilepath});
};
from dancer-plugin-nytprof.
Hey guys, I can't reproduce this. Was it fixed? Can any of you share a snippet that reproduces it?
Thanks!
from dancer-plugin-nytprof.
I'm guessing maybe it only happens with certain Devel::NYTProf
versions? I certainly can't reproduce it when using 5.06.
from dancer-plugin-nytprof.
I'm going to release 0.30 shortly. I'm unable to reproduce this issue on my system. I see that 0183325 is where the problem was introduced, when I added that call to display the request execution times. However, oddly, I'm not seeing that in the list of commits, nor do I see it being reverted - I think something odd is going on with the history here.
from dancer-plugin-nytprof.
Something very weird seems to have happened to the history in this repo :(
As per previous comment, 0183325 is where the probem was introduced (where I started using Devel::NYTProf::Data to fetch profile run durations) - but current master doesn't include that, and I don't see any commits removing it. Furthermore, the version number in master was 0.22, I bumped it up to 0.30 - but the version already on CPAN is 0.31!
Something has gone horribly wrong, and I don't know what it is. Have I somehow force-pushed old stuff over newer stuff or something? I must admit, I'm lost at the moment, and will need to come back to this.
from dancer-plugin-nytprof.
@bigpresh , @garu : Using the lib/Dancer/Plugin/NYTProf.pm
file from the master
branch, I do not run into this issue. The version in CPAN has the issue for me. Also, I'm using the same underlying versionDevel::NYTProf v5.06
. Perhaps you'll have to bump to a version greater than 0.31 to over-ride the incorrect version in CPAN. Thanks again for this plugin! It's come in very handy for me.
from dancer-plugin-nytprof.
The problem is, the version on CPAN appears to be newer than the version in the master branch on GitHub - it has the stuff that shows the run durations etc.
I'm going to need to manually merge what's current on CPAN with what's on GitHub, then implement a fix for the problem this issue is about (your fix looks good) and get it released.
I can only think that maybe I somehow force-pushed changes from an older checkout of the repo or something, blatting some history - I sure don't recall doing that though!
One for another evening when it's not so late, but will get to it soon.
from dancer-plugin-nytprof.
Right - I've carefully merged what was on CPAN with what was in master, and applied your Capture::Tiny-using fix to avoid this issue. When you have a moment, could you confirm that the current version in master works as expected for you?
(Note: I've also added a show_durations
option which disables extracting the run duration from each profile data file, which would hide the problem, but I'm more interested in knowing that the problem has gone away and that you get the runs listed with the duration shown and no unexpected output).
from dancer-plugin-nytprof.
The version in master works. Thanks!
from dancer-plugin-nytprof.
Excellent stuff - I'll get that out to CPAN tonight as 0.40. Thanks for the confirmation!
from dancer-plugin-nytprof.
Right - 0.40 is on its way to CPAN mirrors right now, so I can finally mark this as closed. Sorry this took so damned long to resolve :(
from dancer-plugin-nytprof.
@bigpresh ++
Thank you so much for all the work!
from dancer-plugin-nytprof.
Noticed a duplicated line of code (harmless): https://github.com/bigpresh/Dancer-Plugin-NYTProf/blob/master/lib/Dancer/Plugin/NYTProf.pm#L154
from dancer-plugin-nytprof.
On Tue, 28 Oct 2014 12:27:02 -0700
dibinp [email protected] wrote:
Noticed a duplicated line of code (harmless):
D'oh, good spot - must have been an accident in the merge I was doing.
Removed it in a19f3d2
from dancer-plugin-nytprof.
Thanks for fixing!
from dancer-plugin-nytprof.
@bigpresh ++
Thanks tonnes!!
from dancer-plugin-nytprof.
Related Issues (11)
- Taint problems? HOT 1
- Need configuration option for path of "nytprof.out" file HOT 2
- Ignores application path HOT 2
- Some subroutines are sought in the wrong package HOT 2
- Have some issues getting it to run on Mac OSX HOT 9
- Uri_base to be used for generating link HOT 1
- "Config" does not work, "use" does HOT 4
- Settings HOT 1
- Pod coverage test fails HOT 3
- Does not place nice with '/' (root) endpoint
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dancer-plugin-nytprof.