SlideShare a Scribd company logo
1 of 40
Debugging
Techniques
whoami
David Szöke
Application Engineer @ Unic, Switzerland
2
Cases
3
IIS Crash
Loop
4
IIS Crash Loop
▸ PRD Environment
▸ Authoring environment suddenly
stopped working, 503
▸ Application Pool disabled
▸ IIS Rapid fail protection kicked in
▸ Nothing in Sitecore logs and Windows
Event logs
▸ No solution updates
5
Gather a crash dump
▸ Download and install Debugging Tools
for Windows: https://bit.ly/2WePj2D
▸ Run adplus.exe in crash mode
6
.adplus.exe -pmn "w3wp.exe" -o c:tempcrash-analysis -crash -FullOnFirst
Automated analysis using
DebugDiag
▸ Download and install DebugDiag:
https://bit.ly/2IkVWXx
7
DebugDiag Report
▸ DebugDiag will generate a report:
8
Automated analysis using
PostMortem
▸ PostMortem: https://bit.ly/2JOjUgT
▸ Will also generate a report
9
Correlate gathered information
10
Fixing PRD
▸ What item is breaking PRD?
▸ Why doesn’t it let Sitecore start up?
▸ WinDbg: Also part of Debugging Tools
for Windows
▸ Can load dump files
▸ Supports managed applications (SOS)
▸ Common commands, sequence and
SOS initialization: https://bit.ly/2EGIiN2
11
Finding the conflicting item
12
0:115>!ClrStack -p
[…]
0000007763ec6a80 00007ffcc6038f54
Sitecore.Crash.Foundation.Indexing.ComputedFields.ReferencedItemComputedField.GetRootId(Sitecore.D
ata.Items.Item)
PARAMETERS:
this (0x0000007763ec6b20) = 0x0000018da58644b8
item (0x0000007763ec6b28) = 0x0000018aa8779160
0:115> !DumpObj /d 0000018aa8779160
[...]
MT Field Offset Type VT Attr Value Name
00007ffcc305a1d8 4001f75 8 Sitecore.Data.ID 0 instance 0000018a26f57f38 _itemID
00007ffd1dad7aa0 4001f76 10 System.Object 0 instance 0000018aa8779230 _lock
00007ffcc4f14178 4001f77 18 ...ms.ItemAppearance 0 instance 0000000000000000 _appearance
00007ffcc4b852f0 4001f78 20 ...ta.Items.ItemAxes 0 instance 0000000000000000 _axes
0:115> !DumpObj /d 0000018a26f57f38
[...]
MT Field Offset Type VT Attr Value Name
00007ffd1dac2510 4001c89 18 System.Guid 1 instance 0000018a26f57f50 _guid
00007ffd1dad9e10 4001c8a 10 System.Int32 1 instance -520826525 _hashCode
0:115> dt nt!_GUID 0000018a26f57f50
ntdll!_GUID
{d5729bfe-e486-4a37-8e0d-d1af8738a6aa}
Event Queue
13
▸ Event not marked as done until
processing completed (on web)
select * from dbo.EventQueue where InstanceData like '%d5729bfe-e486-4a37-8e0d-d1af8738a6aa%'
delete from dbo.EventQueue where InstanceData like '%d5729bfe-e486-4a37-8e0d-d1af8738a6aa%'
Found the culprit
14
Summary
▸ Data structure expected as tree, but
received graph
▸ Recursion not handled in code
▸ StackOverflowException
▸ Event not marked as completed
15
A Memory
Leak
16
Memory Leak
▸ Noticed by Operations / Monitoring
▸ Related to Index Rebuilds
▸ Got worse over time (more items)
17
Gathering hang dumps
▸ Using adplus in hang mode
▸ Two separate dumps: before and after
18
.adplus.exe -p 11452 -o c:tempcrash-analysismemory-leak -hang
Comparing two dumps
19
Getting an overview
▸ 2GB retained by Byte[] / ServiceProvider
▸ Compare to vanilla instance
20
Checking similar retention
21
Investigating the
ServiceProvider
22
Checking the code
23
Further Research & Sitecore
Support
▸ Service resolved in computed index fields
▸ https://github.com/aspnet/DependencyInjection
/issues/456
▸ Answer from Sitecore Support:
24
The thing is that some of the Sitecore functionality depends on the
current version of the "Microsoft.Extensions.DependencyInjection.dll" file.
Unfortunately, replacing the mentioned file with a newer version was not
deeply tested, so it could cause some breaking changes and unexpected
behavior.
So, I kindly ask you consider upgrading your Sitecore instance to Sitecore
9.1.
RabbitMQ
processing
stuck
25
RabbitMQ processing stuck
▸ Customer noticed that items are
missing
▸ Middleware logs looked fine
▸ Messages were still in RabbitMq
▸ Nothing in Sitecore logs
26
Gathering some crash dumps
▸ At least 2, some minutes apart
27
.adplus.exe -p 34084 -hang -o C:Tempcrash-analysisimport-stuck
Running DebugDiag
28
Enabling Search Logging
29
Back to DebugDiag
30
SolrNet.Impl.SolrConnection.Get(System.String, System.Collections.Generic.IEnumerable`1>)+1a7
SolrNet.Impl.SolrQueryExecuter`1[[System.__Canon, mscorlib]].Execute(<..>)+71
Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex`1[<..>GetResult(<..>)+297
Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex`1[<..>].Execute[<..>](<..>)+306
Sitecore.Crash.Feature.EventHandlers.ItemSaved.EnsureUniqueTitle.EnsureUnique(<..>)+3f1
Sitecore.Crash.Feature.EventHandlers.ItemSaved.EnsureUniqueTitle.OnItemSaving(<..>)+217
Sitecore.Events.Event+EventSubscribers.RaiseEvent(<..>)+31f
Sitecore.Events.Event.RaiseEvent(System.String, System.Object[])+186
Checking the code
31
Checking SolR Results
32
Google «text to ascii»
33
Summary
▸ Query did not use exact match
▹ Tab interpreted as space by SolR
▸ Input data not sanitized
▸ Method stuck in endless loop
▸ Implemented sanitization in
Middleware and Sitecore
▸ Re-coded unique lookup logic
34
Recap
Extending
your Toolkit
35
dotMemory
▸ Memory Profiler
▸ Visualizes Memory
▸ Automated analysis
▸ Shows Retentions and dependencies
▸ Compare snapshots
▸ YouTube playlist: https://bit.ly/2IdeDw9
36
dotTrace
▸ Performance Profiler
▸ Analyze Locks and Hangs
▸ Performance analysis
▸ Compare snapshots
▸ Different data collection modes
▸ YouTube playlist: https://bit.ly/2Kjtfg5
37
WinDbg
▸ Analyze all the data!
▸ Scriptable + APIs (clrmd)
▸ Steep learning curve, but rewarding
▹ CLR internals
▸ Also a debugger
▸ Recently reworked (Windbg Preview, MS Store)
▸ Doug Rathbone: Investigating ASP.Net Memory
Dumps for Idiots (like Me):
https://bit.ly/2Wae76W
38
DebugDiag Analysis
▸ Automated analysis
▸ Extendable
▸ Great for comparing hang dumps
▸ F1 
39
Thank you!
40

More Related Content

What's hot

Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Andreas Koop
 
Linuxing in London: Docker Intro Workshop
Linuxing in London: Docker Intro WorkshopLinuxing in London: Docker Intro Workshop
Linuxing in London: Docker Intro WorkshopElton Stoneman
 
Xpirit MeetUp: Docker Windows Workshop
Xpirit MeetUp: Docker Windows WorkshopXpirit MeetUp: Docker Windows Workshop
Xpirit MeetUp: Docker Windows WorkshopElton Stoneman
 
DockerCon EU 2017 - Docker on Windows workshop
DockerCon EU 2017 - Docker on Windows workshopDockerCon EU 2017 - Docker on Windows workshop
DockerCon EU 2017 - Docker on Windows workshopElton Stoneman
 
Unleashing Docker with Pipelines in Bitbucket Cloud
Unleashing Docker with Pipelines in Bitbucket CloudUnleashing Docker with Pipelines in Bitbucket Cloud
Unleashing Docker with Pipelines in Bitbucket CloudAtlassian
 
Performance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & WebdriverPerformance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & WebdriverBlazeMeter
 
Continuous Delivery With Selenium Grid And Docker
Continuous Delivery With Selenium Grid And DockerContinuous Delivery With Selenium Grid And Docker
Continuous Delivery With Selenium Grid And DockerBarbara Gonzalez
 
DockerCon 17 EU: Modernizing .NET Apps with Docker
DockerCon 17 EU: Modernizing .NET Apps with DockerDockerCon 17 EU: Modernizing .NET Apps with Docker
DockerCon 17 EU: Modernizing .NET Apps with DockerElton Stoneman
 
Jenkins, pipeline and docker
Jenkins, pipeline and docker Jenkins, pipeline and docker
Jenkins, pipeline and docker AgileDenver
 
Improve your Java Environment with Docker
Improve your Java Environment with DockerImprove your Java Environment with Docker
Improve your Java Environment with DockerHanoiJUG
 
The pain and gains running Docker in live @Pipedrive
The pain and gains running Docker in live @PipedriveThe pain and gains running Docker in live @Pipedrive
The pain and gains running Docker in live @PipedriveRenno Reinurm
 
Continuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsContinuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsCamilo Ribeiro
 
Why so continuous
Why so continuousWhy so continuous
Why so continuousMax Lobur
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins PipelinesSteffen Gebert
 
A CI/CD Pipeline to Deploy and Maintain OpenStack - cfgmgmtcamp2015
A CI/CD Pipeline to Deploy and Maintain OpenStack - cfgmgmtcamp2015A CI/CD Pipeline to Deploy and Maintain OpenStack - cfgmgmtcamp2015
A CI/CD Pipeline to Deploy and Maintain OpenStack - cfgmgmtcamp2015Simon McCartney
 
CI/CD Pipeline to Deploy and Maintain an OpenStack IaaS Cloud
CI/CD Pipeline to Deploy and Maintain an OpenStack IaaS CloudCI/CD Pipeline to Deploy and Maintain an OpenStack IaaS Cloud
CI/CD Pipeline to Deploy and Maintain an OpenStack IaaS CloudSimon McCartney
 
Continuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL ServerContinuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL ServerChris Adkin
 
Jenkins Pipeline 101 and TCI - presentation and workshop
Jenkins Pipeline 101 and TCI - presentation and workshopJenkins Pipeline 101 and TCI - presentation and workshop
Jenkins Pipeline 101 and TCI - presentation and workshopYoram Michaeli
 

What's hot (20)

Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
Deployment Best Practices on WebLogic Server (DOAG IMC Summit 2013)
 
Linuxing in London: Docker Intro Workshop
Linuxing in London: Docker Intro WorkshopLinuxing in London: Docker Intro Workshop
Linuxing in London: Docker Intro Workshop
 
Xpirit MeetUp: Docker Windows Workshop
Xpirit MeetUp: Docker Windows WorkshopXpirit MeetUp: Docker Windows Workshop
Xpirit MeetUp: Docker Windows Workshop
 
DockerCon EU 2017 - Docker on Windows workshop
DockerCon EU 2017 - Docker on Windows workshopDockerCon EU 2017 - Docker on Windows workshop
DockerCon EU 2017 - Docker on Windows workshop
 
Unleashing Docker with Pipelines in Bitbucket Cloud
Unleashing Docker with Pipelines in Bitbucket CloudUnleashing Docker with Pipelines in Bitbucket Cloud
Unleashing Docker with Pipelines in Bitbucket Cloud
 
Performance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & WebdriverPerformance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & Webdriver
 
Continuous Delivery With Selenium Grid And Docker
Continuous Delivery With Selenium Grid And DockerContinuous Delivery With Selenium Grid And Docker
Continuous Delivery With Selenium Grid And Docker
 
DockerCon 17 EU: Modernizing .NET Apps with Docker
DockerCon 17 EU: Modernizing .NET Apps with DockerDockerCon 17 EU: Modernizing .NET Apps with Docker
DockerCon 17 EU: Modernizing .NET Apps with Docker
 
Jenkins, pipeline and docker
Jenkins, pipeline and docker Jenkins, pipeline and docker
Jenkins, pipeline and docker
 
Improve your Java Environment with Docker
Improve your Java Environment with DockerImprove your Java Environment with Docker
Improve your Java Environment with Docker
 
The pain and gains running Docker in live @Pipedrive
The pain and gains running Docker in live @PipedriveThe pain and gains running Docker in live @Pipedrive
The pain and gains running Docker in live @Pipedrive
 
Continuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsContinuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and Jenkins
 
Why so continuous
Why so continuousWhy so continuous
Why so continuous
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
 
A CI/CD Pipeline to Deploy and Maintain OpenStack - cfgmgmtcamp2015
A CI/CD Pipeline to Deploy and Maintain OpenStack - cfgmgmtcamp2015A CI/CD Pipeline to Deploy and Maintain OpenStack - cfgmgmtcamp2015
A CI/CD Pipeline to Deploy and Maintain OpenStack - cfgmgmtcamp2015
 
CI/CD Pipeline to Deploy and Maintain an OpenStack IaaS Cloud
CI/CD Pipeline to Deploy and Maintain an OpenStack IaaS CloudCI/CD Pipeline to Deploy and Maintain an OpenStack IaaS Cloud
CI/CD Pipeline to Deploy and Maintain an OpenStack IaaS Cloud
 
Continuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL ServerContinuous Integration With Jenkins Docker SQL Server
Continuous Integration With Jenkins Docker SQL Server
 
Welcome to Jenkins
Welcome to JenkinsWelcome to Jenkins
Welcome to Jenkins
 
GlassFish Embedded API
GlassFish Embedded APIGlassFish Embedded API
GlassFish Embedded API
 
Jenkins Pipeline 101 and TCI - presentation and workshop
Jenkins Pipeline 101 and TCI - presentation and workshopJenkins Pipeline 101 and TCI - presentation and workshop
Jenkins Pipeline 101 and TCI - presentation and workshop
 

Similar to Advanced Debugging Techniques

HCL Commerce Developer V9.1.11 Installation
HCL Commerce Developer V9.1.11 InstallationHCL Commerce Developer V9.1.11 Installation
HCL Commerce Developer V9.1.11 InstallationFrancisBooth2
 
Microsoft Hardware Certification Kit (HCK) setup
Microsoft Hardware Certification Kit (HCK) setupMicrosoft Hardware Certification Kit (HCK) setup
Microsoft Hardware Certification Kit (HCK) setupYan Vugenfirer
 
Continuous Security: From tins to containers - now what!
Continuous Security: From tins to containers - now what!Continuous Security: From tins to containers - now what!
Continuous Security: From tins to containers - now what!Michael Man
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Ben Hall
 
Google Cloud Platform Special Training
Google Cloud Platform Special TrainingGoogle Cloud Platform Special Training
Google Cloud Platform Special TrainingSimon Su
 
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...Sharon James
 
Development tools at Base
Development tools at BaseDevelopment tools at Base
Development tools at BaseDominik Kapusta
 
What to Do When You Don’t Know What to Do: Control System Patching Problems a...
What to Do When You Don’t Know What to Do: Control System Patching Problems a...What to Do When You Don’t Know What to Do: Control System Patching Problems a...
What to Do When You Don’t Know What to Do: Control System Patching Problems a...EnergySec
 
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...Evgeniy Kuzmin
 
Three amigos: Bitbucket + Jenkins + Docker
Three amigos: Bitbucket + Jenkins + DockerThree amigos: Bitbucket + Jenkins + Docker
Three amigos: Bitbucket + Jenkins + DockerDaniel Gordillo
 
Simplifying Multi-User SOLIDWORKS Implementations
Simplifying Multi-User SOLIDWORKS ImplementationsSimplifying Multi-User SOLIDWORKS Implementations
Simplifying Multi-User SOLIDWORKS ImplementationsHawk Ridge Systems
 
SDLC Using Docker for Fun and Profit
SDLC Using Docker for Fun and ProfitSDLC Using Docker for Fun and Profit
SDLC Using Docker for Fun and Profitdantheelder
 
Google cloud functions
Google cloud functionsGoogle cloud functions
Google cloud functionsPéter Nagy
 
Continuous integration / continuous delivery
Continuous integration / continuous deliveryContinuous integration / continuous delivery
Continuous integration / continuous deliveryEatDog
 
The How and Why of Windows containers
The How and Why of Windows containersThe How and Why of Windows containers
The How and Why of Windows containersBen Hall
 
6 Months Sailing with Docker in Production
6 Months Sailing with Docker in Production 6 Months Sailing with Docker in Production
6 Months Sailing with Docker in Production Hung Lin
 
Akmal Khaleeq Waheed - Challenge 3
Akmal Khaleeq Waheed - Challenge 3Akmal Khaleeq Waheed - Challenge 3
Akmal Khaleeq Waheed - Challenge 3tovmug
 
Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3Velocidex Enterprises
 

Similar to Advanced Debugging Techniques (20)

HCL Commerce Developer V9.1.11 Installation
HCL Commerce Developer V9.1.11 InstallationHCL Commerce Developer V9.1.11 Installation
HCL Commerce Developer V9.1.11 Installation
 
Microsoft Hardware Certification Kit (HCK) setup
Microsoft Hardware Certification Kit (HCK) setupMicrosoft Hardware Certification Kit (HCK) setup
Microsoft Hardware Certification Kit (HCK) setup
 
IIS Web Ecosystem
IIS Web EcosystemIIS Web Ecosystem
IIS Web Ecosystem
 
Continuous Security: From tins to containers - now what!
Continuous Security: From tins to containers - now what!Continuous Security: From tins to containers - now what!
Continuous Security: From tins to containers - now what!
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
 
Google Cloud Platform Special Training
Google Cloud Platform Special TrainingGoogle Cloud Platform Special Training
Google Cloud Platform Special Training
 
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
 
Development tools at Base
Development tools at BaseDevelopment tools at Base
Development tools at Base
 
What to Do When You Don’t Know What to Do: Control System Patching Problems a...
What to Do When You Don’t Know What to Do: Control System Patching Problems a...What to Do When You Don’t Know What to Do: Control System Patching Problems a...
What to Do When You Don’t Know What to Do: Control System Patching Problems a...
 
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
 
Three amigos: Bitbucket + Jenkins + Docker
Three amigos: Bitbucket + Jenkins + DockerThree amigos: Bitbucket + Jenkins + Docker
Three amigos: Bitbucket + Jenkins + Docker
 
KB Article 1-FINAL
KB Article 1-FINALKB Article 1-FINAL
KB Article 1-FINAL
 
Simplifying Multi-User SOLIDWORKS Implementations
Simplifying Multi-User SOLIDWORKS ImplementationsSimplifying Multi-User SOLIDWORKS Implementations
Simplifying Multi-User SOLIDWORKS Implementations
 
SDLC Using Docker for Fun and Profit
SDLC Using Docker for Fun and ProfitSDLC Using Docker for Fun and Profit
SDLC Using Docker for Fun and Profit
 
Google cloud functions
Google cloud functionsGoogle cloud functions
Google cloud functions
 
Continuous integration / continuous delivery
Continuous integration / continuous deliveryContinuous integration / continuous delivery
Continuous integration / continuous delivery
 
The How and Why of Windows containers
The How and Why of Windows containersThe How and Why of Windows containers
The How and Why of Windows containers
 
6 Months Sailing with Docker in Production
6 Months Sailing with Docker in Production 6 Months Sailing with Docker in Production
6 Months Sailing with Docker in Production
 
Akmal Khaleeq Waheed - Challenge 3
Akmal Khaleeq Waheed - Challenge 3Akmal Khaleeq Waheed - Challenge 3
Akmal Khaleeq Waheed - Challenge 3
 
Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3
 

Recently uploaded

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Advanced Debugging Techniques

  • 5. IIS Crash Loop ▸ PRD Environment ▸ Authoring environment suddenly stopped working, 503 ▸ Application Pool disabled ▸ IIS Rapid fail protection kicked in ▸ Nothing in Sitecore logs and Windows Event logs ▸ No solution updates 5
  • 6. Gather a crash dump ▸ Download and install Debugging Tools for Windows: https://bit.ly/2WePj2D ▸ Run adplus.exe in crash mode 6 .adplus.exe -pmn "w3wp.exe" -o c:tempcrash-analysis -crash -FullOnFirst
  • 7. Automated analysis using DebugDiag ▸ Download and install DebugDiag: https://bit.ly/2IkVWXx 7
  • 8. DebugDiag Report ▸ DebugDiag will generate a report: 8
  • 9. Automated analysis using PostMortem ▸ PostMortem: https://bit.ly/2JOjUgT ▸ Will also generate a report 9
  • 11. Fixing PRD ▸ What item is breaking PRD? ▸ Why doesn’t it let Sitecore start up? ▸ WinDbg: Also part of Debugging Tools for Windows ▸ Can load dump files ▸ Supports managed applications (SOS) ▸ Common commands, sequence and SOS initialization: https://bit.ly/2EGIiN2 11
  • 12. Finding the conflicting item 12 0:115>!ClrStack -p […] 0000007763ec6a80 00007ffcc6038f54 Sitecore.Crash.Foundation.Indexing.ComputedFields.ReferencedItemComputedField.GetRootId(Sitecore.D ata.Items.Item) PARAMETERS: this (0x0000007763ec6b20) = 0x0000018da58644b8 item (0x0000007763ec6b28) = 0x0000018aa8779160 0:115> !DumpObj /d 0000018aa8779160 [...] MT Field Offset Type VT Attr Value Name 00007ffcc305a1d8 4001f75 8 Sitecore.Data.ID 0 instance 0000018a26f57f38 _itemID 00007ffd1dad7aa0 4001f76 10 System.Object 0 instance 0000018aa8779230 _lock 00007ffcc4f14178 4001f77 18 ...ms.ItemAppearance 0 instance 0000000000000000 _appearance 00007ffcc4b852f0 4001f78 20 ...ta.Items.ItemAxes 0 instance 0000000000000000 _axes 0:115> !DumpObj /d 0000018a26f57f38 [...] MT Field Offset Type VT Attr Value Name 00007ffd1dac2510 4001c89 18 System.Guid 1 instance 0000018a26f57f50 _guid 00007ffd1dad9e10 4001c8a 10 System.Int32 1 instance -520826525 _hashCode 0:115> dt nt!_GUID 0000018a26f57f50 ntdll!_GUID {d5729bfe-e486-4a37-8e0d-d1af8738a6aa}
  • 13. Event Queue 13 ▸ Event not marked as done until processing completed (on web) select * from dbo.EventQueue where InstanceData like '%d5729bfe-e486-4a37-8e0d-d1af8738a6aa%' delete from dbo.EventQueue where InstanceData like '%d5729bfe-e486-4a37-8e0d-d1af8738a6aa%'
  • 15. Summary ▸ Data structure expected as tree, but received graph ▸ Recursion not handled in code ▸ StackOverflowException ▸ Event not marked as completed 15
  • 17. Memory Leak ▸ Noticed by Operations / Monitoring ▸ Related to Index Rebuilds ▸ Got worse over time (more items) 17
  • 18. Gathering hang dumps ▸ Using adplus in hang mode ▸ Two separate dumps: before and after 18 .adplus.exe -p 11452 -o c:tempcrash-analysismemory-leak -hang
  • 20. Getting an overview ▸ 2GB retained by Byte[] / ServiceProvider ▸ Compare to vanilla instance 20
  • 24. Further Research & Sitecore Support ▸ Service resolved in computed index fields ▸ https://github.com/aspnet/DependencyInjection /issues/456 ▸ Answer from Sitecore Support: 24 The thing is that some of the Sitecore functionality depends on the current version of the "Microsoft.Extensions.DependencyInjection.dll" file. Unfortunately, replacing the mentioned file with a newer version was not deeply tested, so it could cause some breaking changes and unexpected behavior. So, I kindly ask you consider upgrading your Sitecore instance to Sitecore 9.1.
  • 26. RabbitMQ processing stuck ▸ Customer noticed that items are missing ▸ Middleware logs looked fine ▸ Messages were still in RabbitMq ▸ Nothing in Sitecore logs 26
  • 27. Gathering some crash dumps ▸ At least 2, some minutes apart 27 .adplus.exe -p 34084 -hang -o C:Tempcrash-analysisimport-stuck
  • 30. Back to DebugDiag 30 SolrNet.Impl.SolrConnection.Get(System.String, System.Collections.Generic.IEnumerable`1>)+1a7 SolrNet.Impl.SolrQueryExecuter`1[[System.__Canon, mscorlib]].Execute(<..>)+71 Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex`1[<..>GetResult(<..>)+297 Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex`1[<..>].Execute[<..>](<..>)+306 Sitecore.Crash.Feature.EventHandlers.ItemSaved.EnsureUniqueTitle.EnsureUnique(<..>)+3f1 Sitecore.Crash.Feature.EventHandlers.ItemSaved.EnsureUniqueTitle.OnItemSaving(<..>)+217 Sitecore.Events.Event+EventSubscribers.RaiseEvent(<..>)+31f Sitecore.Events.Event.RaiseEvent(System.String, System.Object[])+186
  • 33. Google «text to ascii» 33
  • 34. Summary ▸ Query did not use exact match ▹ Tab interpreted as space by SolR ▸ Input data not sanitized ▸ Method stuck in endless loop ▸ Implemented sanitization in Middleware and Sitecore ▸ Re-coded unique lookup logic 34
  • 36. dotMemory ▸ Memory Profiler ▸ Visualizes Memory ▸ Automated analysis ▸ Shows Retentions and dependencies ▸ Compare snapshots ▸ YouTube playlist: https://bit.ly/2IdeDw9 36
  • 37. dotTrace ▸ Performance Profiler ▸ Analyze Locks and Hangs ▸ Performance analysis ▸ Compare snapshots ▸ Different data collection modes ▸ YouTube playlist: https://bit.ly/2Kjtfg5 37
  • 38. WinDbg ▸ Analyze all the data! ▸ Scriptable + APIs (clrmd) ▸ Steep learning curve, but rewarding ▹ CLR internals ▸ Also a debugger ▸ Recently reworked (Windbg Preview, MS Store) ▸ Doug Rathbone: Investigating ASP.Net Memory Dumps for Idiots (like Me): https://bit.ly/2Wae76W 38
  • 39. DebugDiag Analysis ▸ Automated analysis ▸ Extendable ▸ Great for comparing hang dumps ▸ F1  39

Editor's Notes

  1. David Szöke Application Engineer at Unic in Switzerland This talk is about debugging techniques Because there is always the possibility that you missed some constellations while developing, testing or in the automated tests which could break your enviroment I’ve prepared 3 real world cases which I though might be interesting to you We are going to look at how we approached these issues, what tools we used and how we tracked down the root cause
  2. Let’s start with the first one
  3. After executing the command, go and grab a coffee. Depending on the size of your application and type of error, this might take some minutes -pmn: defines process name to be monitored. ADPlus will keep monitoring if a process with this name starts and attach We are also using the –FullOnFirst argument, which will generate a full dump, even if only a first chance exception occurred. -crash: Since the application is in fact crashing, we provide the –crash argument. Another option would be –hang, which we will cover in another case After the dump has been generated, you will end up with something like in the screenshot
  4. From here, we have several options: We can either directly go to hardcore mode and spin up windbg, or we can first run some automated analysis on the dump. Let’s start with the automated analysis first. Microsoft provides a set of diagnostics tools, called DebugDiag. Next to the analyser, there is also a utility for gathering crash dumps. The nice thing there is, that it also provides a GUI. So if you didn’t like the previous CLI approach, you could also use DebugDiag for that. So let’s spin up DebugDiag Analysis and select our freshly generated crash dumps
  5. DebugDiag will generate a report which can be displayed in the browser In the .NET Threads Summary we can see that there is StackOverflowException in Thread 114
  6. An alternative to DebugDiag is PostMortem. It’s a simple tool I wrote a few months ago in order to facilitate and make crash dump analysis somewhat easier. You can clone it from my Github account. Like DebugDiag, it will generate a report which you can display in the browser It will not only tell us, that there is a StackOverflowException, but also display the stack trace of the Thread the exception happened in Looking at the stack trace, we can see that there is clearly something going on in the ReferencedItemComputedField.GetRootId method
  7. There was in fact a recursive call User requirements: Items imported Reference to each other We expected tree, but got a graph Fixed by implementing a circuit breaker, list that would be passed
  8. So we were able to fix the bug, but the system was still down and had to go up as soon as possible. Therefore, we had to find the conflicting item. Due to the fact that we had over 100’000 content items in 42 different language versions, we couldn’t just click through each item, but had to come up with a different solution. Let’s enter windbg It’s a multipurpose debugger by Microsoft. It was originally made for unmanaged applications, but Microsoft also provides a debugging extension called «Son Of Strike» allowing you to debug managed applications as well. It’s more or less a CLI and has a pretty steep learning curve, but the more you use it, the more rewarding it’s going to get. Especially when you are able to track down an proof an issue. So for starters, I created a short markdown file which lists some common commands and a way to initialize the SOS extensions.
  9. With WinDbg open, we opened the dump of the StackOverflowException WinDbg will automatically set you to the current threads where the exception occured We can now run the !ClrStack –p command to display the stack trace, including the parameters Input is highlighted in blue, important addresses are in yellow
  10. Remote event only removed when processing complete
  11. We were able to correlate the memory leaks to index rebuilds through monitoring tools and Sitecore logs
  12. <Explain difference to crash dumps>
  13. Switch to second dump <explain difference between «Largest Size» and «Largest Retained Size»> It usually helps to compare these graphs with a dump of a vanilla Sitecore instance. Usually, the
  14. <Explain similar retention>
  15. Talk about _transientDisposables
  16. We were able to confirm that the SampleService was in fact registered as transient And indeed, the class also implements Idisposable. And surely enough, it also allocates a byte array We’ve also checked the referenced to the class and were able to confirm, that it was resolved in a computed field
  17. The original problem was happening in an import job. I’ve ported the problem to an event handler, just for demo purposes and easier implementation
  18. Again in hang mode Note that there is also a –r parameter which can be used to take a dump in a defined interval
  19. Run with multiple dumps in «CrashHangMode»
  20. So if these were really SolR queries, they should show up in the search logs, right? Next thing we did was to enable search logs. By default, we had them disabled on the Solution, as they were generating just too much data
  21. Requirements Ensure title is unique across all items
  22. Use while developing Not much time investment needed to get a good understanding of the tool