.net core进程dump

ASP.NET Core 线上内存溢出问题与 dotnet-dump 排查方法 本文分享了在 ASP.NET Core 应用中排查内存溢出问题的实际经验。通过使用 dotnet-dump 工具,获取并分析内存转储文件,定位到内存泄漏的根源。文章详细介绍了如何通过 clrstack 和 dumpheap 命令分析堆栈和对象分配情况,并借助 dotnet-counters 和 dotnet-gcdump 等工具进行实时监控和垃圾回收分析。最终,通过优化缓存管理和垃圾回收机制,解决了内存溢出问题。文章还总结了定期内存分析和优化资源管理的措施,以帮助开发者避免类似问题的发生。 阅读详情

一、Linux dump

1、环境

操作系统:Linux version 4.14.119-200.el7.x86_64 (mockbuild@x86-02.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)) #1 SMP Fri May 17 00:01:39 UTC 2019

运行环境:.net core 3.1.15

部署方式:docker 容器部署

2、dump 进程

2.1 dump 工具

.net core运行环境提供有createdump工具,可以在不安装其他插件的情况下直接使用此工具dump进程文件;

通过find /usr/share -name createdump 找到工具所在目录;

2.2 dump 应用进程

MES通过容器部署,默认的应用进程是1;如果不知道进程的话,可以通过ps aux | grep dotnet  ,查看进程

知道进程后,直接使用createdump工具dump进程

docker exec -it imes-prod bash

/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.15/createdump 1 -u -f App_Data/dump062701.dmp   -- -u为full类型(需要VS分析这个类型比较好),默认为mini类型

特别说明:如果是linux下dump文件到windows下分析,尽量使用-u 完整dump,这样应用相关dll都会附带上,便于分析

方式二:宿主机dump

宿主机是没有安装.net core 运行环境的,所以需要先安装.net core 3.1,然后再安装dotnet-dump工具

详见:dotnet-dump 诊断工具 - .NET CLI | Microsoft Learn

二、Windows dump

windows下dump更为简单,直接在任务管理器中可dump进程

 

dotnet-dump 入门:抓取与分析 .NET 进程 dump 本文通过一个内存泄漏示例,介绍使用 dotnet-dump 分析 .NET 进程内存问题的完整流程。首先使用 dotnet-counters 观察 GC 指标确认问题,然后通过 dotnet-dump 抓取 full dump 快照,最后用 SOS 扩展命令分析堆对象和 GC 引用链,定位到由静态缓存导致的内存泄漏源头。文中详细演示了关键命令如 !dumpheap 和 !gcroot 的使用方法,并提供了示例代码和修复建议,帮助开发者掌握 .NET 内存问题的诊断方法。 阅读详情

相关推荐

5分钟搞定Conflux钱包注册:Fluent钱包从安装到转账全流程指南

本文提供Conflux公链上Fluent钱包的完整注册和使用指南,涵盖从安装、助记词备份到CFX转账的全流程。特别强调安全操作要点,包括助记词保管和网络选择,帮助用户5分钟内快速掌握这款国产公链钱包的核心功能,确保数字资产安全。

weixin_29181861的博客 239

.Net Core在Linux环境dump分析

文章目录前言1. 生成dump文件2. 读取dump文件的三个方式通过windbg+sos读取dotnet自带的dotnet-dump进行读取使用lldb+sos读取(推荐)3.分析 前言 在本地开发调试的时候,基于VS的工具能方便看出内存泄露的信息: 但到了线上,一般都是在linux环境中,并且服务运行在docker上,这时出现内存泄露,CPU异常等情况,就无法直接调试,只能把docker中在...

frankjie的博客 6398

Ubuntu20.04下Docker无缝升级实战指南

本文提供了一份在Ubuntu20.04系统上安全、无缝升级Docker的实战指南。文章详细阐述了升级前的版本检查、数据备份等准备工作,逐步演示了通过APT包管理器进行升级或指定版本安装的操作步骤,并强调了升级后的验证与常见问题回滚方案,确保业务容器平稳过渡。

postgres8guard的博客 475

【愚公系列】2023年10月 .NET CORE工具案例-控制台调试神器之Dumpify

Dumpify 是.NET程序员的调试神器,它能够帮助程序员快速地定位和解决.NET程序中的问题。它在调试过程中能够生成.NET应用程序的内存转储文件(也称为dump文件),并分析和显示相关信息。Dump文件包含了.NET应用程序在运行时的所有状态和信息,包括变量、堆栈、线程和内存中的对象等。使用Dumpify可以快速地分析和定位.NET应用程序的问题,减少调试时间和提高效率。

愚公智库 4万+

18、基于FSDD数据集的深度学习案例分析

本文基于FSDD(Free Spoken Digit Dataset)数据集,系统介绍了深度学习在语音数字识别中的应用。内容涵盖动态与静态计算图的对比、数据预处理流程(包括数据增强、固定长度处理和归一化)、监督学习与无监督学习的模型构建与训练过程,并通过实验对比了不同网络架构的性能。文中使用PyTorch实现2层全连接网络和自编码器模型,展示了正则化技术对提升模型准确率的关键作用。最后总结了关键技术并提出了实际应用建议,展望了未来在复杂模型、多模态融合和实时应用方向的发展潜力。

vscode6remote的博客 255

Android软键盘系统深度解析:架构、原理与实现

Android软键盘系统深度解析:架构与实现原理 本文系统剖析了Android软键盘的核心工作机制。作为系统级输入服务,软键盘具有双重属性:既是可安装的独立应用,又深度集成于系统框架中。文章详细解读了软键盘的系统架构,包括其与InputMethodManagerService(IMMS)和WindowManagerService(WMS)的交互机制,以及通过InputConnection实现的跨进程通信流程。同时分析了输入法窗口的特殊管理策略、布局调整模式,并深入探讨了输入预测引擎的实现原理,包括词典加载、

保持专注,保持热爱 107

.NET Core Dump 分析:深入故障排查的利器

在软件开发和运维过程中,程序崩溃或异常行为是不可避免的。当.NET Core应用程序出现性能问题或崩溃时,了解应用程序在故障发生时的状态对于快速定位和解决问题至关重要。这时,.NET Core Dump分析便成为了一个强大的工具。本文将介绍.NET Core Dump的基本概念、如何生成Dump文件以及如何利用工具进行Dump分析,从而帮助开发者和运维人员深入排查和解决.NET Core应用程序中...

dotNET跨平台 788

【PINN物理信息网络】基于PINN物理信息网络结合Wave 2D有限差分方法(python)

【PINN物理信息网络】基于PINN物理信息网络结合Wave 2D有限差分方法(python)

k8291121的博客 1812

.NET Core dump 分析

服务 CPU 或 内存偶尔飙高是部署环境中经常遇到的问题,一般会采用记录日志的方式来诊断,不过有些情况靠日志可能并不能分析出个所以然,面对实在无头绪的问题也只能暂时使用重启大法先恢复。为了...

dotNET跨平台 2226

基于STM32L4XX、HAL库的AD7124模数转换器ADC驱动程序设计

/ 检查ID是否正确 (AD7124-4/AD7124-8有不同的ID)// 转换为电压值 (假设使用内部2.5V基准)// 构造读命令: 1(R/W) + 1(0) + 6(寄存器地址)// 构造写命令: 0(R/W) + 1(0) + 6(寄存器地址).config = 0, // 使用配置0。内置可编程增益放大器(PGA):1-128倍。// 读取ADC数据。// 读取当前ADC控制寄存器。// 检查数据是否就绪。// 写回ADC控制寄存器。// 初始化AD7124。

zhusl6688的博客 510

工业预测性维护实战:振动分析+Transformer预警系统构建指南

摘要:本文聚焦工业设备预测性维护难题,提出基于振动分析与Transformer模型的全栈解决方案。通过低成本硬件选型(单传感器¥380)实现设备振动信号实时采集,利用边缘计算单元完成特征工程(RMS、峰度、峰值频率提取),并在云端部署Transformer时序模型进行异常预警。某风电龙头企业实践显示,系统将故障误报率从38%降至6%,维护成本降低58%,非计划停机时长减少87%。文中提供完整的边缘端特征提取代码、云端模型架构及实施流程,适配ISO 13373振动分析标准,为制造业设备健康管理提供可复用的工程

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 616

dotnet core CPU高问题定位 dotnet-dump

原文出处:dotnet core 高CPU定位 dotnet-dump篇 - linFen - 博客园 在windows操作系统,我们可以用Windbg定位,那在linux微软也提供dotnet-dump定位 准备 # 注册 Microsoft 密钥和源 sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm # 安装 .NET Core SDK yum install do

gavinoldmen的专栏 1499

YOLO11改进:轻量级改进 | 通用倒瓶颈(UIB)搜索块结合C3k2二次创新 | 轻量化之王MobileNetV4

通用倒瓶颈(UIB)搜索块替代YOLO11的C3k2

会AI的学姐 288

聊一聊 .NET Dump 中的 Linux信号机制

简单的说Linux信号是一种进程间通信机制,大概可以做三件事情。通知进程发生了某种事件,比如:段错误。允许进程间发送简单的消息。控制进程行为,比如:终止、暂停、继续等。信号名称信号编号说明SIGQUIT3通常由 Ctrl+\ 触发SIGILL4非法指令SIGABRT6由 abort() 函数产生SIGFPE8浮点异常SIGSEGV11段错误(非法内存访问)SIGBUS7总线错误(内存访问对齐问题等)SIGSYS31错误的系统调用SIGTRAP5。

weixin_41070082的博客 36

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

使用dotnet-counters和dotnet-dump 分析.NET Core 项目内存占用问题

在.NET Core 项目部署后,我们往往会遇到内存占用越来越高的问题,但是由于项目部署在Linux上,因此无法使用VS的远程调试工具来排查内存占用问题。那么这篇文章我们大家一起来学习一下如何排查内存占用问题。接下来,我们把调试环境配置好。和。是一个性能监视工具,用于应用运行状况监视以及简单的性能问题排查。它可以快速监视 CPU 的使用情况以及 .NET Core 应用程序中引发的异常率。它可以在不调试器代码的情况下收集和分析 操作系统 转储的方法。

喵叔 2366

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Windows中使用createdump创建进程dump文件的基本用法

Windows中使用createdump创建进程dump文件的基本用法

gc_2299的博客 584

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

使用dotnet-dump 查找 .net core 3.0 占用CPU 100%的原因

  公司的产品一直紧跟 .net core 3.0 preview 不断升级, 部署到 Linux 服务器后, 偶尔会出现某个进程CPU占用100%.  由于服务部署在云上, 不能使用远程调试; 在局域网内的Linux 服务器 或 Windows开发机上又不能重现这个问题, 联想到Java的jstack, 很是羡慕啊. 想到.net core 已经出来这么久了, 还是试着找找看吧, 结果还真找到一...

weixin_30387799的博客 313

unix 获取程序占用内存_使用dotnetdump 查找 .net core 3.0 占用CPU 100%的原因

  公司的产品一直紧跟 .net core 3.0 preview 不断升级, 部署到 Linux 服务器后, 偶尔会出现某个进程CPU占用100%.  由于服务部署在云上, 不能使用远程调试; 在局域网内的Linux 服务器 或 Windows开发机上又不能重现这个问题, 联想到Java的jstack, 很是羡慕啊. 想到.net core 已经出来这么久了, 还是试着找找看吧, 结果...

weixin_39533174的博客 306
上一篇: log4net 应用重启日志被覆盖
下一篇: 为什么你一定要会 Dump 分析?
人丰
博客等级 码龄18年 2粉丝 23原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值