当前位置: 首页 > web >正文

【ubuntu24.04】pycharm 死机结束进程

windows 远程pycharm到ubuntu执行程序

  • pycharm 在调试过程中,内存耗尽,然后死机了

pycharm 进程

(base) root@k8s-master-pfsrv:/home/zhangbin/下载# ps -ef | grep pycharm
root      121245 3230568  0 5月14 pts/8   00:00:00 /bin/bash --rcfile /root/.cache/JetBrains/RemoteDev/dist/b0c1870a0e7bc_pycharm-professional-242.21829.44/plugins/terminal/shell-integrations/bash/bash-integration.bash -i
root      121246 3230568  0 5月14 pts/9   00:00:00 /bin/bash --rcfile /root/.cache/JetBrains/RemoteDev/dist/b0c1870a0e7bc_pycharm-professional-242.21829.44/plugins/terminal/shell-integrations/bash/bash-integration.bash -i
root      884268 2292779  0 5月15 pts/10  00:00:00 /bin/bash --rcfile /root/.cache/JetBrains/RemoteDev/dist/a63ecb49ae401_pycharm-professional-2024.3.5/plugins/terminal/shell-integrations/bash/bash-integration.bash -i
root     2292766       1  0 5月12 ?       00:00:00 /bin/sh /root/.cache/JetBrains/RemoteDev/dist/a63ecb49ae401_pycharm-professional-2024.3.5/bin/remote-dev-server.sh run /home/zhangbin/perfwork/01_ai/12_exp_v1.2
root     2292779 2292766 11 5月12 ?       17:28:12 /root/.cache/JetBrains/RemoteDev/dist/a63ecb49ae401_pycharm-professional-2024.3.5/bin/remote-dev-server run /home/zhangbin/perfwork/01_ai/12_exp_v1.2
root     2292869 2292779  0 5月12 ?       00:00:16 /root/.cache/JetBrains/RemoteDev/dist/a63ecb49ae401_pycharm-professional-2024.3.5/bin/fsnotifier
root     2387852 2292779  0 5月12 pts/1   00:00:00 /bin/bash --rcfile /root/.cache/JetBrains/RemoteDev/dist/a63ecb49ae401_pycharm-professional-2024.3.5/plugins/terminal/shell-integrations/bash/bash-integration.bash -i
root     2387853 2292779  0 5月12 pts/0   00:00:00 /bin/bash --rcfile /root/.cache/JetBrains/RemoteDev/dist/a63ecb49ae401_pycharm-professional-2024.3.5/plugins/terminal/shell-integrations/bash/bash-integration.bash -i
root     3108391 2292779  0 5月13 pts/5   00:00:00 /bin/bash --rcfile /root/.cache/JetBrains/RemoteDev/dist/a63ecb49ae401_pycharm-professional-2024.3.5/plugins/terminal/shell-integrations/bash/bash-integration.bash -i
root     3108393 2292779  0 5月13 pts/6   00:00:00 /bin/bash --rcfile /root/.cache/JetBrains/RemoteDev/dist/a63ecb49ae401_pycharm-professional-2024.3.5/plugins/terminal/shell-integrations/bash/bash-integration.bash -i
root     3230555       1  0 5月13 ?       00:00:00 /bin/sh /root/.cache/JetBrains/RemoteDev/dist/b0c1870a0e7bc_pycharm-professional-242.21829.44/bin/remote-dev-server.sh run /home/zhangbin/perfwork/01_ai/01_semantic-text2image-search
root     3230568 3230555  4 5月13 ?       05:48:54 /root/.cache/JetBrains/RemoteDev/dist/b0c1870a0e7bc_pycharm-professional-242.21829.44/bin/remote-dev-server run /home/zhangbin/perfwork/01_ai/01_semantic-text2image-search
root     3230654 3230568  0 5月13 ?       00:00:12 /root/.cache/JetBrains/RemoteDev/dist/b0c1870a0e7bc_pycharm-professional-242.21829.44/bin/fsnotifier
root     3707660  534637  0 16:27 pts/3    00:00:00 grep --color=auto pycharm

一键kill

(base) root@k8s-master-pfsrv:/home/zhangbin/下载# ps -ef | grep pycharm | grep -v grep | awk '{print $2}' | xargs kill -9
(base) root@k8s-master-pfsrv:/home/zhangbin/下载# ps -ef | grep pycharm
root     3708702  534637  0 16:28 pts/3    00:00:00 grep --color=auto pycharm
(base) root@k8s-master-pfsrv:/home/zhangbin/下载# 

脚本

#!/bin/bash# 获取所有PyCharm相关进程的PID(除了grep自己)
PIDS=$(ps -ef | grep pycharm | grep -v grep | awk '{print $2}')# 显示将要终止的进程
echo "将要终止以下进程:"
ps -f $PIDS# 先尝试正常终止
echo "正在尝试正常终止进程..."
for pid in $PIDS; doecho "终止进程 $pid"kill $pid
done# 等待3秒,看是否有进程自行终止
sleep 3# 检查是否还有进程存在
REMAINING_PIDS=$(ps -p $PIDS -o pid= 2>/dev/null)
if [ -n "$REMAINING_PIDS" ]; thenecho "以下进程没有响应,将强制终止:"ps -f $REMAINING_PIDSfor pid in $REMAINING_PIDS; doecho "强制终止进程 $pid"kill -9 $piddone
fi# 最后确认
sleep 1
if ps -p $PIDS >/dev/null 2>&1; thenecho "警告:仍有一些进程未能终止"
elseecho "所有PyCharm相关进程已经终止"
fi
http://www.xdnf.cn/news/7108.html

相关文章:

  • Docker配置SRS服务器 ,ffmpeg使用rtmp协议推流+vlc拉流
  • 阿克曼-幻宇机器人系列教程4- 建图
  • C#自定义扩展方法 及 EventHandler<TEventArgs> 委托
  • 大语言模型上下文长度:发展历程、局限与技术突破
  • 【RabbitMQ】 RabbitMQ高级特性(二)
  • 2025软考高级信息系统项目管理师英文选择题攻略
  • esp32课设记录(二)lcd屏显示文字与照片
  • 基于开源AI智能名片链动2+1模式S2B2C商城小程序源码的去中心化商业扩散研究
  • 智慧园区数据大脑管理平台整体解决方案
  • React中巧妙使用异步组件Suspense优化页面性能。
  • 系统架构设计(十二):统一过程模型(RUP)
  • Spring Boot JWT认证示例项目
  • 【PRB】深度解析GaN中最浅的受主缺陷
  • 基于WebRTC的实时语音对话系统:从语音识别到AI回复
  • 数据结构 -- 树形查找(二)平衡二叉树
  • 【自然语言处理与大模型】向量数据库:Chroma使用指南
  • JAVA EE(进阶)_进阶的开端
  • 仿腾讯会议——退出房间
  • Linux概述:从内核到开源生态
  • DOM知识点
  • 2_Spring【IOC容器中获取组件Bean】
  • 计算机科技笔记: 容错计算机设计05 n模冗余系统 TMR 三模冗余系统
  • 【25软考网工】第六章(7)网络安全防护系统
  • 入门OpenTelemetry——应用自动埋点
  • 20242817-李臻-课下测试:基于商用密码的数字信封协议(AI)
  • 基于 STM32 的手持式安检金属探测器设计与实现
  • AI大模型学习二十六、使用 Dify + awesome-digital-human-live2d + ollama + ChatTTS打造数字人
  • 图绘Linux:基础指令脉络阁
  • 学习黑客Active Directory 入门指南(二)
  • C语言:在 Win 10 上,gcc 如何编译 调用 Tcl/Tk 的C程序