Tuesday, November 18, 2008

What's installed in a Windows box?

See here for downloading and use msiinv.exe.

Wednesday, November 12, 2008

IIS7: COM 0x800703E3 error

Problem: when requesting static files against IIS7, following error was reported to event viewer

0x800703E3
at System.Web.Hosting.IIS7WorkerRequest.FlushCore(Boolean keepConnected, Int32 numBodyFragments, IntPtr[] bodyFragments, Int32[] bodyFragmentLengths, Int32[] bodyFragmentTypes)
at System.Web.Hosting.IIS7WorkerRequest.FlushCachedResponse(Boolean isFinal)
at System.Web.HttpResponse.UpdateNativeResponse(Boolean sendHeaders)
at System.Web.HttpRuntime.FinishRequestNotification(IIS7WorkerRequest wr, HttpContext context, RequestNotificationStatus& status)

Solution: known issue in IIS7, fixed by Microsoft .NET Framework 3.5 Service Pack 1

SQL: Excessive SQL Compilations/Sec

Problem: SQL Compilations/Sec greater than 50 sec in a mid-end backend.
Cause: Store procedures not being fully parameterized. If they were, their plans could have been cached and reused for same runs with different parameters.

Some related links:

http://www.sql-server-performance.com/tips/stored_procedures_p1.aspx
http://www.sql-server-performance.com/tips/sql_server_performance_monitor_coutners_p1.aspx
http://support.microsoft.com/kb/243588
http://msdn.microsoft.com/en-us/library/aa212698(SQL.80).aspx

Wednesday, November 5, 2008

Tuesday, September 23, 2008

Sansa m250: How to see it as a drive on XP

Menu, Settings, USB, choose the one that is not Autodetect ☺

Tuesday, September 16, 2008

SharePoint: Output caching not retrieving pages from cache

Symptom:

for subsequent requests, you see the date in the output page (right click IE page, View Source, etc) updated (it should remain constant for the period of time page in cache is not invalidated):

>>> Rendered using cache profile:Public Internet (Purely Anonymous) at: 2008-09-16T12:59:31

Solution:

This issue may happen for requests that include query strings, like '?var=val'.

Go to http://your%20server/cache%20profiles/allitems.aspx, and set 'Vary by Query String Parameters' to the value of the query param (in the example above, 'var') for the appropriate cache profiles.

Thursday, September 11, 2008

SharePoint: Root folder element not returned through SPList.GetItems(SPQuery)

Problem: a query like this

                SPQuery q = new SPQuery();
q.Query = "<Where><Eq><FieldRef Name='MyField'/><Value Type='Text'>ABC</Value></Eq></Where>";
q.ViewAttributes = "Scope=\"Recursive\"";
SPListItemCollection c = l.GetItems(q);
Console.WriteLine(c.Count);

on a list like with one element like

Folder, MyField='ABC'

was not returning the element.

Solution:

q.ViewAttributes = "Scope=\"RecursiveAll\"";

See here why ☺

Tuesday, August 12, 2008

Perfmon: "Unable to connect to machine"

1) grant Local Service full control permissions on HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Perflib
2) Start Remote Registry service

Friday, August 1, 2008

SQL: retrieve store procedures definitions in SQL Server

select P.name, M.definition
from sys.sql_modules M
inner join sys.procedures P
on P.object_id = M.object_id
order by P.name

Wednesday, July 30, 2008

Windbg cheat-sheet

*** steps to find an exception

.symfix
.sympath+
.reload
sxd *
.loadby sos mscorwks
!threads
kp
!do *throwable*
!do *_stackTraceString*

*** debugging dump

lmv mmscorwks
.reload /f mscorwks.dll
!load sos
!threads
!clrstack
!pe -nested

*** setup

.sympath srv*g:\binaries*http://msdl.microsoft.com/download/symbols
.reload
.symfix
ld -> loads module symbols
ld moduleName
.loadby sos mscorwks

*** memory

d
dw
dd
dd /c 1 00401060 -> display dwords in 1 column from address 00401060
db
da -> ascii
du -> unicode
dds myFunction -> try to resolve symbol
dv -> display variables (needs symbols)
dv /V
dt -> display type
dt _EXCEPTION_POINTERS
ln -> list near

*** search

s -> search memory
s -a 77f75acc L80 "B" -> searches from 77f75acc to 77f75acc+80 for the ascci 'B'
s 77f75acc L80 42 40 3a -> searches from 77f75acc to 77f75acc+80 for the string 42, 40 and 3a
x -> search symbols
x *! -> list of all the modules in the process with their beginning and ending memory locations
x *!my* -> list the functions that start with 'my' in all modules
x my!* -> list the functions in 'my' module

*** registers

r
rm

*** step

g -> go until breakpoint
p -> step
t -> step into
gu -> step out
pa -> st
ta -> trace into to address
.restart
bp function -> set breakpoint
bp function "command" (ex.: bp kernel32!CreateFileW "du poi(esp+4); g")
bp address

*** stack

k
kP
.frame
kb 50 -> show 50 frames
~*k5 -> for each thread, show 5 frames

*** assembly

u -> unassemble function
uf myFunction
!u -> unassemble managed function

*** exceptions

sxe ld (to disable sxd)
sxe clr -> break in CLR exceptions

*** windows

!gle -> GetLastError()

*** dumps

!threads
!DumpObj = !do
!DumpStackObjects
!dt
!dso
!pe -nested
!peb
.cordll -u -l
!dumpheap -type theType

*** dumps (2)

lmv mmscorwks
Find matching package at \\server\share and copy all files (except symbols) to c:\debuggers folder
.loadby sos mscorwks (or, if doesn't work, .load %debuggers%\sos.dll)
May need to execute .cordll –u –l

*** help

!help

*** sources

.srcpath
.lines
.l+, .l-

*** security descriptor

!object \BaseNamedObjects\CLR_CASOFF_MUTEX
dt nt!_OBJECT_HEADER objHeader
?? SecurityDescriptor & ~0x7
!sd *result* 1

*** kernel dbg setup

in Vista:
bcdedit /bootdebug ON
bcdedit /dbgsettings SERIAL DEBUGPORT:1 BAUDRATE:115200
in XP: in boot.ini
/debug /debugport=com1 /baudrate=115200
connect Vista to box XXX with a null cable
in XXX
- kd.exe -server tcp:port=999 -k com:port=com1,baud=115200
- from windbg: .server tcp:port=999

restart Vista
to start debugging, kd.exe -remote tcp:server=serverboxname,port=999

From WinPE:

bcdedit /store c:\boot\bcd -enum -v
GUID corresponding to Vista -> {GUID}
bcdedit /store c:\boot\bcd –debug {GUID} on

*** kernel dbg

!stacks -> list threads
!locks -> lists locks

*** SOS commands

Object Inspection
-----------------------------
DumpObj (do)
DumpArray (da)
DumpStackObjects (dso)
DumpHeap
DumpVC
GCRoot
ObjSize
FinalizeQueue
PrintException (pe)
TraverseHeap

Examining CLR data structures
-----------------------------
DumpDomain
EEHeap
Name2EE
SyncBlk
DumpMT
DumpClass
DumpMD
Token2EE
EEVersion
DumpModule
ThreadPool
DumpAssembly
DumpMethodSig
DumpRuntimeTypes
DumpSig
RCWCleanupList
DumpIL

Examining code and stacks
-----------------------------
Threads
CLRStack
IP2MD
U
DumpStack
EEStack
GCInfo
EHInfo
COMState
BPMD

Diagnostic Utilities
-----------------------------
VerifyHeap
DumpLog
FindAppDomain
SaveModule
GCHandles
GCHandleLeaks
VMMap
VMStat
ProcInfo
StopOnException (soe)
MinidumpMode

Thursday, May 15, 2008

IIS: RPS suddendly drops to zero while serving static files

Problem: while running tests on an IIS web site, RPS dropped to zero, then came back up, etc.

Solution: NTFS may be causing disk I/O to be the bottleneck by logging reads to those static files. Try setting

HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate

to 1 (DWORD), reboot (not sure which services need to be restarted for avoiding a reboot...), and try.

More details here.

Monday, April 14, 2008

Debugging: No Locals, Breakpoint not being hit, etc in Visual Studio

Problem: sometimes, VS has trouble seeing Locals for optimized assemblies. Also, even with symbols loaded for a module, a breakpoint is not hit. Or you attach to the w3wp.exe process only to not see your module as loaded (and you know it is).

Solution: say your assembly is My.dll

  1. Create a file called My.ini
  2. Put this content into that file:
  3. [.Net Framework Debugging Control]
    AllowOptimize=0
    GenerateTrackingInfo=1

  4. Copy the .ini file to the location of the assembly in the GAC

Tuesday, March 25, 2008

Performance: ASP.NET process not being registered by vsperfmon

Problem: by following these instructions: TN_1206: Profiling ASP.NET in instrumentation mode from the command line, I was not getting the w3wp.exe process being registered by vsperfmon, so no .vsp file was being generated.

Solution: make sure to call vsperfmon with the /crosssession parameter

Wednesday, January 16, 2008

SharePoint: Enabling Anonymous Access on a Site Collection

First, you need to configure the web application for anonymous access:

  1. go to Central Administration
  2. go to Application Management
  3. click on Authentication Providers
  4. choose the Web Application the site collection lives into
  5. click on the zone for the specified provider
  6. check Enable Anonymous Access and Save

Then, you need to enable anonymous access in the specific site collection:

  1. Go to Site Actions Site Settings Modify All Site Settings
  2. Click on Advanced Permissions
  3. Click on Settings Anonymous Access
  4. choose desired anonymous access, then OK