简体   繁体   English

您将如何纠正无响应的应用程序?

[英]How would you approach to rectify a non-responsive application?

Just now i was interviewed by ca(Computer Associates) for a C++ opening.刚才我接受了 ca(Computer Associates) 的采访,要求我开张 C++。

Q:There is an application that continuously runs for days.. at some day it becomes non-responsive/gets hanged.How would you Debug/rectify the application.What will be your first steps?问:有一个应用程序连续运行了好几天......在某一天它变得无响应/被挂起。你将如何调试/纠正应用程序。你的第一步是什么?

A:I answered starting with.. having a check on memory usage details/CPU usage..checking if some of the required resources are available...or if it is network bound,if the network is live..etc..答:我的回答是从...开始检查 memory 使用详细信息/CPU 使用情况...检查某些所需资源是否可用...或者它是否是网络绑定的,如果网络是实时的......等等。

Q:He told.. these are all superficial things.. assume no such problem is there..then?问:他说..这些都是表面的东西..假设不存在这样的问题..那么?

A:I told the best way is to check the debug logs if they are enabled..and if they arent..give the customer a debug enabled application and test it in the field.答:我告诉过最好的方法是检查调试日志是否已启用..如果它们没有..给客户一个启用调试的应用程序并在现场进行测试。 Because the application is hanging intermittently..its very difficult to detect through any other way why it would go unresponsive..And debug logs would tell me at what instant the application starts to go mad,as to find the root cause the specific operation responsible needs to be known,and debug logs are what i think the best bet.因为应用程序间歇性挂起..很难通过任何其他方式检测到为什么它会 go 无响应..并且调试日志会告诉我应用程序在什么时刻开始 go 疯狂,以找到根本原因负责的具体操作需要知道,调试日志是我认为最好的选择。

The interviewer switched to another question says.. ok fine.面试官切换到另一个问题说..好的。

So,was my answer good enough.Any other approach that a good programmer would follow?那么,我的回答是否足够好。一个好的程序员会遵循的任何其他方法吗?

Use WinDbg or create a (mini) dump file and load it up in your Visual Studio.使用 WinDbg 或创建一个(迷你)转储文件并将其加载到您的 Visual Studio 中。 Load debugging symbols for all the release binaries, and see exactly where it is hung加载所有发布二进制文件的调试符号,并查看它的确切挂起位置

That should be a decent first step这应该是一个不错的第一步

Edit Of course I was (foolishly) assuming windows for no apparent reason.编辑当然,我(愚蠢地)假设 windows 没有明显的原因。 On UNIX/linux this would be even easier using strace , ptrace , gdb --remote , pstack , dtrace (if it's there) etc在 UNIX/Linux 上,使用straceptracegdb --remotepstackdtrace (如果有的话)等会更容易

Edit Also using WMI performance counters/perfmon is a very good practice in general.编辑通常,使用 WMI 性能计数器/性能计数器也是一种非常好的做法。 This would perhaps shed some light (but I'm sure the interviewer was looking for the 'How do I inspect a running application' type of answer; this is slightly leaning to the 'depend on logging' approach that you already had mentioned in your own answer)这可能会有所启发(但我确信面试官正在寻找“如何检查正在运行的应用程序”类型的答案;这略微倾向于您在您的文章中已经提到的“依赖于日志记录”方法自己的答案)

Most of the times such questions cannot be answered to the point because they are very much subjective.大多数情况下,此类问题无法得到准确回答,因为它们非常主观。 They are usually asked to evaluate & judge how a potential candidate approaches a problem and shows some constructive approach of debugging the problem.他们通常被要求评估和判断潜在候选人如何解决问题,并展示一些调试问题的建设性方法。 As long as the answer shows some logical methodology of tackling the problem the answer is good.只要答案显示了解决问题的一些合乎逻辑的方法,答案就很好。

Your answer was good.你的回答很好。 To add to it, Most important is to identify the use case/pattern where the problem occurs.除此之外,最重要的是确定出现问题的用例/模式。 If a problem is reproducble easily it is solvable.如果一个问题很容易重现,那么它是可以解决的。 So I would try to define steps to reproduce the problem and then move ahead with steps to tackle it.所以我会尝试定义重现问题的步骤,然后继续解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM