简体   繁体   English

是什么原因导致在PC崩溃之前将nul字符写入文件?

[英]What causes a nul character written to file just before a pc crash?

We have an application running on several thousand identical machines. 我们有一个应用程序在几千台相同的机器上运行。 Same OS, same hardware, same application installation. 相同的OS,相同的硬件,相同的应用程序安装 On very rare occasions, the machine locks up. 在非常罕见的情况下,机器锁定。 Alt tab, ctrl-alt-del, application are all unresponsive. Alt选项卡,ctrl-alt-del,应用程序都没有响应。 After inspecting our applications log file, a series of null characters are written to the end, as the last data before the crash. 检查我们的应用程序日志文件后,会将一系列空字符写入结尾,作为崩溃前的最后一个数据。

I'm hoping to use this fact as a means to debug the lockup. 我希望用这个事实来调试锁定。 My guess is that the number of null characters written is equivalent to the space I need to allocate for my log statement, but the content is never actually written to disk. 我的猜测是,写入的空字符数等于我需要为日志语句分配的空间,但内容实际上从未写入磁盘。 I'm also guessing a disk IO problem occurred, prevent the write, and of course, the OS lockup. 我也猜测发生了磁盘IO问题,阻止了写入,当然还有OS锁定。 I can't confirm of this. 我无法证实这一点。 So I guess my question is - have you ever seen a condition like this, how did it occur, and how might you go about troubleshooting it? 所以我想我的问题是 - 你有没有见过这样的情况,它是如何发生的,你怎么去排除故障呢?

I've seen this type of thing happen, I think you're looking in the right general direction. 我已经看到这种事情发生了,我认为你正在寻找正确的方向。

When this happens I assume you're able to pinpoint the exact hardware? 当发生这种情况时,我假设您能够精确定位硬件? after failure I'd recommend running a memtest (http://www.memtest.org/). 失败后,我建议运行memtest(http://www.memtest.org/)。

I've seen this sort of thing with power supplies, bad disk controllers, etc. You can go insane trying to track them down. 我已经看过电源,坏磁盘控制器等等。你可能会疯狂地试图追踪它们。

Seems like you're going about this the right way - see if you can find a way to force the problem to happen more quickly, when it happens run the memtest, run chkdsk /R (check the eventlog for controller errors during this) 看起来你正在以正确的方式解决这个问题 - 看看你是否能找到一种方法来加快问题的发生,当它发生时运行memtest,运行chkdsk / R(在此期间检查事件日志中的控制器错误)

any chance you could get a kernel debugger attached? 你有没有机会连接内核调试器?

any chance %SystemRoot%\\memory.dmp was produced? 是否有机会生成%SystemRoot%\\ memory.dmp?

NTFS does not journal data (only metadata), so things like that can happen. NTFS不会记录数据(仅限元数据),因此可能会发生类似情况。 The reason why is just that at the time of the crash/hang, the metadata (file size, data block allocation) was committed, but not the data (data block contents). 原因只是在崩溃/挂起时,提交了元数据(文件大小,数据块分配),而不是数据(数据块内容)。 Unfortunately this is normal behavior with NTFS and will not give you any insight into the problem causing the hang. 不幸的是,这是NTFS的正常行为,并不会让您深入了解导致挂起的问题。

So the answer is: a crash at the "right" time can cause this. 所以答案是:在“正确”时间崩溃可能导致这种情况。

BTW: The same thing can of course happen with FAT/FAT32. BTW:FAT / FAT32当然可以发生同样的事情。

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

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