TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Finding and Fixing a Five Second Stall

95 点作者 jamesmiller5超过 12 年前

10 条评论

eric-hu超过 12 年前
While I'm a web dev and not a Windows coder, this post is a great example of why I come back to HN.<p>&#62; From experience, I’ve learned that it’s always best to fully understand a problem before you fix it. If you just patch over its symptoms but never figure out what the problem really was, it will often come back to haunt you.<p>Philosophical-level statements like this really help me as a dev, since my one of my biggest hurdles is getting traction for even simple 1-2 line refactors that, in my opinion, can simplify code and improve maintainability. Far too often, I hear "just get it done", and I like to be reminded with statements like this of why "just get it done" doesn't always result in a better bottom line for the company.<p>&#62;For some reason, I took this concept to heart in a programming sense and have found it is a good rule to code by. My version of the static discipline, adapted for software, is that whenever you are making a modification to a piece of code, you should always leave it in a state of stability equal to or better than how you found it. And preferably the latter.<p>I try to do this where I can too, and again, appreciate the philosophical explanation. It prepares me to more thoroughly and calmly explain my own work style.<p>The author laments Windows development, and I can only contrast that with my experience on an open source web stack (Ruby on Rails, Backbone.js). The upside of working with open source is that I can crack open the gem (library) I'm using and investigate the logic myself. I could fix the bugs or extend the code to do what I want. That is pretty cool.<p>The downside of working with open source software is that documentation is horrid. As the author states, man-hours are finite, and people who write OSS typically don't want to spend their finite hours documenting their code. I just take these as tradeoffs. It seems like Microsoft invests heavily in documentation, but I guess the author's point is that they can still do better.
评论 #4940847 未加载
评论 #4940802 未加载
JoeAltmaier超过 12 年前
Windows is saddled with baroque interfaces that are there only because they've always been there. Microsoft OS developers try to simulate or stub out old behaviors, in an effort to keep old app code running without breaking anything too badly.<p>Such a crust of backward compatibility code weighs heavily on a decades-old OS.
评论 #4940717 未加载
vl超过 12 年前
Oh, the joys of Win32 programming.<p>Back in the day I wrote networking service that was occasionally failing under stress load with memory corruption. I was staring at rare dumps, re-reading code and documentation to no avail. Finally, after few days of debugging, I went ahead and located debug symbols and sources (oh, I happened to work at Microsoft at the time) for the build of Windows we used at the test lab, it was relatively arcane procedure back then (it got better later, but at the time it was either symbol server doesn't work, or sources don't match).<p>So I setup gflags with memory guards and windbg and started waiting. After few days of stress run it finally crashed again and there it was - comment in the code of the crashing library saying "OVERLAPPED can be deallocated at this time if completion ports are used, but we save this value to it here anyways for backward compatibility reasons with bla-bla." Glad that you told me guys, I guess now I have to rewrite it and refcount the OVERLAPPED! I still don't know how I could debug it without the source access. (Ironically, it also enlightened me on why service I implemented at the startup before was occasionally crashing as well).<p>And don't even start me on implementing SSL support in the service.
breadbox超过 12 年前
Reading this really brought back memories of when I was writing Windows code. It really felt like half of any project was spent on working around the OS, rather than with it.
评论 #4941527 未加载
moconnor超过 12 年前
I had the opposite experience yesterday. A colleague and I were tracking down a rare race condition that became more likely with more threads. A signal handler was being re-entered, which the man page suggested shouldn't happen because by default the signal is blocked during handler execution.<p>Because this was Linux, we were able to read the kernel source to see what actually happens. It turns out that the signal is only blocked for the current thread, and Linux will deliver it to the first unblocked thread instead.<p>This misunderstanding also came from a less explicit API doc, although not outright incorrect. But because we had full stack source we didn't need guesswork, a good night's sleep or inspiration. Just curiosity and persistence.<p>There's a zen-like calm to knowing you can always, always follow a bug through the entire system, that everything happens for a reason and you can open an editor and see what those reasons are.<p>I will miss this deeply if I ever return to closed-platform development.
评论 #4942113 未加载
owenfi超过 12 年前
Is there some 'platform complexity' measurement metric along the lines of a 'code complexity' indicator? It would be useful for finding platforms/languages/environments with less pain and as a way to track improvements as well.<p><a href="http://owenfi.com/post/38255106579/windows-keyboard-apis" rel="nofollow">http://owenfi.com/post/38255106579/windows-keyboard-apis</a>
评论 #4940117 未加载
wallflower超过 12 年前
Reminds me of this one job where we had to call LockWindowUpdate to get an Excel/VBA-based application to perform.<p><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd145034(v=vs.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/desktop/dd14...</a>
评论 #4940606 未加载
chrisdevereux超过 12 年前
My favourite win32 api is this little gem for flushing a file output buffer to the physical disk: <a href="http://support.microsoft.com/kb/148505" rel="nofollow">http://support.microsoft.com/kb/148505</a>
评论 #4940998 未加载
revelation超过 12 年前
They are using a low-level hook to disable the expected behavior of a "get me out of here" key.<p>They deserve all the stalls they can get. The reason it was so complicated to get this behavior in the first place is because its heavily <i>discouraged</i>.<p>Not to mention that calling SetWindowsHookEx will flag you as a keylogger in every antivirus snakeoil in existence.
评论 #4940312 未加载
评论 #4940119 未加载
评论 #4940702 未加载
RBerenguel超过 12 年前
&#62;&#62; The great thing about programming on Windows is that it is the only commercially viable platform where you can ship software to users without getting approval from a giant bureaucracy &#60;&#60;<p>I kind of had the feeling I could write code for a Mac and ship it.<p>Wait, in some sense I have done so before with code for computing fractals I shared with other Mac users in my department. It worked perfectly in my Mac and their Mac.<p>Wait! I have downloaded and paid for apps straight from some developers websites (top of my mind, or top of my menu bar: Hazel, 1Password, Arq)<p>So I just stopped my reading there, sadly.
评论 #4940186 未加载
评论 #4940070 未加载
评论 #4939936 未加载
评论 #4940250 未加载
评论 #4939929 未加载