6 ms·
What to do when your Amazon EBS fails
- lelandbatey 14y agoThis is a total side question but I noticed this line: > The process was stuck in the kernel waiting for an IOCTL, so killing the process did nothing – even kill -9. It was going to stay that way until EBS was back to normal. I did not know that can happen! Can anyone provide a further explanation/material for why this is the case?
- 1SaltwaterC 14y agoIIRC is the only case where you can not kill a process under unices. It goes into the D state (uninterruptible sleep). Usually waiting for I/O is the reason for a process going into a D state. From my own experience, had this issue with faulty hardware and network filesystems. Here's something easy for reproducing a process going into uninterruptible sleep: GlusterFS 3.0.4 (Ubuntu 10.04 packages that version, a single machine setup is sufficient). A bug in Gluster turns into a deadlock and the process that triggers that bug does into the D state. Cause: using file locks without explicit unlock when releasing the file descriptor. The process can't be killed as it waits for the FS while the FS waits for the process to release the lock (which never happens). Had fun debugging that on a live deployment where each process got stuck one by one till the process pool was exhausted, while monit could not restart the daemon that managed the process pool.
- matthewlucid 14y agoThree links for you: https://jira.mongodb.org/browse/SERVER-6178 https://jira.mongodb.org/browse/SERVER-6178 http://www.noah.org/wiki/Kill_-9_does_not_work http://www.noah.org/wiki/Kill_-9_does_not_work http://stackoverflow.com/questions/223644/what-is-an-uninterruptable-process http://stackoverflow.com/questions/223644/what-is-an-uninter... The first is the bug I reported to 10gen about their MongoDB setup. Contained in the bug report is the set of commands I used to reproduce the issue so that you can see it yourself. The second and third links are about processes in uninterruptible sleep, which is the state my MongoDB processes were in. It should give more detail than I'm about to give. Linux processes all have a state (running, sleeping, etc). One of those states is "Uninterruptible Sleep". Only the kernel can change a process's state. Uninterruptible sleep ("D" in `top`) is a state in which the process will receive no interrupts (signals). Since the `kill` command is just a glorified signal sender, it ceases to work for those processes.
- ajross 14y agoProcesses blocked in system calls can be unkillable. In the Linux kernel, what typically happens is that the process is blocked on a wait queue (what userspace usually call a "condition variable" or "monitor") in one of the wait_event() family of functions. Because the kernel doesn't implement any kind of exception handling, there is no way to automatically break out of this; you have to wait for some other task to call wake_up(). It's possible to wait in a "interruptible" way, and many subsystems do. But that's hard, because it means that the resources you would otherwise be responsible for clean up need to be detected and cleaned up by someone else (or alternatively that someone else needs to pick up and finish what you started, or you need to be able to roll back a partially completed action, etc...). Userspace usually ignoes this problem (because the task got killed, right?), but in the kernel a leak is a huge bug. So the default is that waiting in the kernel means that the kernel can't allow the process to be terminated (or otherwise be delivered a signal that would invalidate the stack). And the side effect is that userspace sees an unkillable process in the "D" state.
- deleted 14y ago[deleted]
- old-gregg 14y agoCan I ask: why do people chose to waste their very precious time writing software to deal with EBS failures (and other AWS deficiencies) instead of just not using AWS? The world is full of wonderful alternatives like SoftLayer, for example (no affiliation). We've been running a very high traffic system there with individual box uptimes of 700 days before we had to reboot them during scheduled OS upgrade/maintenance. The "AWS scaling stories" I hear at dev. meetups make absolutely no sense. People, AWS original sales pitch was to take care of scaling for you, not the other way around. The developers obsession with AWS amazes me. It's like paying for a BMW and being proud of carrying around a self-made toolbox in case of an engine failure in the middle of nowhere, and everyone is proud to "know someone inside Amazon". Since when establishing a personal relationship with a car mechanic is seen as "cool"? Why not just pick a quality brand?
- crazygringo 14y agoSerious question -- how are alternatives so much better? You've always got to "waste your very precious time" on something -- putting together servers, dealing with hard drive crashes, etc. No matter what, you have to plan for things breaking, and a lot of the time, they'll break in ways you couldn't plan for. It's not like there are other cloud platforms out there with zero failures and zero deficiencies. But how, for example, is SoftLayer better than AWS?
- old-gregg 14y ago> But how, for example, is SoftLayer better than AWS? Where do I begin... The latency to our dedicated DB servers is always 1-2 milliseconds. Never 5. Never 50. I do not understand how people tolerate 50ms response time from memcached servers on AWS. We pay much less "per request". Way less. We never have to worry about servers disappearing. We don't need proprietary APIs for server images because the Chef script makes me a DB or a DNS box out of any Linux box. We do not waste any time "architecting for failure": our databases run on RAID arrays with hot standbys, no need for chaos monkeys. Everything is very, very simple. We never used SoftLayer documentation because nothing of what we use needs to be documented. And most importantly, we had less than an hour of downtime in 3 years. And none of that was Softlayer's fault. It becomes much harder to reason about performance, uptime and responsiveness of your system when the underlying infrastructure does not provide guarantees on basic building blocks like I/O latency. Everything on AWS is always in flux and you have to over-allocate resources and/or over-engineer around those faulty building blocks. It may make you feel like a hero to survive in this jungle, but doesn't it look like a "forced premature optimization"? 99% of every graduating YC class could be running on a single pair of dedicated low-end servers and saving themselves a TON of time.
- agwa 14y agoI use the iptables reject trick all the time. It's particularly useful when you have a bunch of servers in a DNS round robin. When one of them adds the reject rule, clients start failing over to the next server in the DNS round robin essentially immediately.
- contingencies 14y agoHow about using a proven high availability solution such as Corosync/Pacemaker instead of rewriting a limited implementation from scratch? http://corosync.org/ http://corosync.org/
- druiid 14y agoUp-voting you because, well, everyone always forgets about Corosync. About the only criticism one could have had about it was that when it only supported multicast you couldn't use it with EC2 and other providers that (for good reason) blocked multicast. It now can do UDPU so it works on EC2. The other great thing about corosync+pacemaker is that it's super easy to write your own HA scripts. Need mongodb? Then write your own script(not sure why you'd use corosync for this, but you could...).
- jperras 14y agoMaybe I'm missing something, but why not create a software RAID 1+0 array of disks (easily doable with EBS volumes and mdadm) instead of relying on a heartbeat-style solution as described in this post?