mishrsud / mvc-mini-profiler

Automatically exported from code.google.com/p/mvc-mini-profiler
0 stars 0 forks source link

Mini Profiler falsely reports duplicate queries #62

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I noticed this was happening while trying out the profiler today. 

A search of this forum and stack overflow led me to this question 
(http://stackoverflow.com/questions/6585270/mvc-mini-profiler-falsely-showing-du
plicate-queries) but I couldn't find an issue here so I thought I'd raise one. 
Hope that's ok.

What steps will reproduce the problem?
Not sure exactly - haven't had time to delve into it - but here's what I'm 
doing in it's most basic form:

Clicking a button, triggering sending multiple ajax calls to an MVC Action (via 
jquery $.ajax). The action has a few using(profiler.Step("Whatever")) blocks.

I would expect to see the number of reported requests in the MVC profiler 
exactly match the number of AJAX requests.

Instead, one or two of the requests are invariably duplicated in the profiler 
output. As I increase the number of requests, the amount of duplicates 
increases too - navigating to a page that performs a large amount of AJAX 
requests (around 10-15) I get some that are duplicated 3 or 4 times.

Looking at the requests in Glimpse I see my set of AJAX requests happening once 
each, and corresponding calls to /mvc-mini-profiler/, some of which have 
duplicate GUIDs so there are more of these than there were AJAX requests.

What version of the product are you using? On what operating system?
Version 1.6, Windows 7 64-bit.

Thanks everyone, love the profiler and hope this helps.

Original issue reported on code.google.com by randomse...@gmail.com on 22 Jul 2011 at 3:53

GoogleCodeExporter commented 8 years ago
Project that reproduces this issue has been uploaded to 
http://code.google.com/p/mvc-mini-profiler/issues/detail?id=43

Original comment by randomse...@gmail.com on 24 Jul 2011 at 6:17

GoogleCodeExporter commented 8 years ago
Yeah ... found it ... weird bug ... try latest 

Original comment by sam.saff...@gmail.com on 25 Jul 2011 at 8:20

GoogleCodeExporter commented 8 years ago
This issue isn't actually fixed in the latest checkin.

Still using that sample project I sent you, I still get duplicates, though less 
so.

And there appears to be some confusion in the profiler about which query the 
SQL belongs to. The sample project sends 4 queries, each of which performs 
exactly 1 SQL statement querying on a different field, so I'd expect each 
profiler entry to have "1 sql" with the corresponding statement underneath. 
However, very often a SQL query from one AJAX request will end up under another 
entry, so there'll be a request that has no sql statements and one with 2.

Not sure I've explained that clearly enough - are you seeing this as well?

Original comment by randomse...@gmail.com on 25 Jul 2011 at 8:57

GoogleCodeExporter commented 8 years ago
I also see duplicates sometimes with ajax requests, say my page makes an ajax 
request at the bottom of the page just after the mini profiler code loads, I 
will sometimes see a) the ajax request is missing in the results, or b) I see 
duplicate results, I find that adding something like a setTimeout for 50 or 
100ms before my ajax load at the end of the page it will work properly.

This is without any sql profiling either. It seems as though it loads a GUID's 
results twice.

Original comment by stefan.s...@gmail.com on 25 Jul 2011 at 9:08

GoogleCodeExporter commented 8 years ago
yeah my guess is that the javascript include is cached in your browser ... can 
you try it in anon mode ... the fix is: 
http://code.google.com/p/mvc-mini-profiler/source/diff?spec=svn9ae6f19a344f537c6
f3a6edcf6369069080af433&r=9ae6f19a344f537c6f3a6edcf6369069080af433&format=side&p
ath=/MvcMiniProfiler/UI/Includes.js please review

Original comment by sam.saff...@gmail.com on 25 Jul 2011 at 10:32

GoogleCodeExporter commented 8 years ago
My apologies, trying in a different browser fixed the duplicates issue.

However, the other problem of SQL statements occasionally being attached to the 
wrong profiler result still remains. Should I open a new issue for that as the 
duplicates one appears to be fixed?

Thanks again for the quick fixes :)

Original comment by randomse...@gmail.com on 25 Jul 2011 at 11:04

GoogleCodeExporter commented 8 years ago
yes please .. that is a harder one to solve 

Original comment by sam.saff...@gmail.com on 25 Jul 2011 at 11:25

GoogleCodeExporter commented 8 years ago
Suspected it might be! :)

Original comment by randomse...@gmail.com on 25 Jul 2011 at 11:29

GoogleCodeExporter commented 8 years ago
Sam fix looks good, what I was thinking, keep
Track of ids we are fetching. What does this have to do with cache though? You 
mean the 2nd request never hits the server? And happens to just return the 
results again instead of I assume a 2nd request for an Id would return an error 
or empty result.

Original comment by stefan.s...@gmail.com on 25 Jul 2011 at 12:41