207 points · by strzalek · 11y ago · 85 comments
- Ctrl-r for reverse-search through history
- typing 'ps' to find the process status utility (of course)
- pressing Enter,....and realizing that Ctrl-r actually found 'stopserver.sh' in history instead. (There's a ps inside stoPServer.sh)
I got a call from the head Sales Trader within 5 seconds asking why his GUI showed that all Orders were paused. Luckily, our recovery code was robust and I could restart the server and resume trading in half a minute or so.
That's $250 million to $400 million of orders on pause for half a minute. Not to mention my heartbeat.
Renamed stopserver.sh to stop_server.sh after that incident :|
P.S. typing speed is not merely overrated, but dangerous in some contexts. Haste makes waste.
echo "This will STOP THE SERVER. Are you sure you want to do this?"
echo "Type 'yes' to continue:"
read response
if [[ $response != "yes" ]]
then
echo "You must type 'yes' to continue. Aborting."
exit 1
fi
echo "Stopping server ..."
It barely takes any time to type 'yes' but it makes you stop and think.Might be better to start reviewing EVERY command one sends to important servers, and testing them if viable. What probably is the line that vijucat took... that's the line that everybody ends up taking, the only thing that changes is the number of accidents needed.
response=$1
echo "This will STOP THE SERVER. Are you sure you want to do this?"
echo "Type 'yes' to continue:"
[[ $response ]] || read response
if [[ $response != "yes" ]]
then
echo "You must type 'yes' to continue. Aborting."
exit 1
fi
echo "Stopping server ..."
Which will allow you to run the script with "./scriptname.sh yes" to bypass the check.EDIT: Though, as you say, it is much better not to be running anything like this on a live server anyway. Any change should be part of a deployment procedure that is carefully checked and tested, as well as having a rollback procedure in the event of something horrible happening.
Of course, in the real world, you sometimes don't have that luxury and you just have to hope and pray :-)
When I ask myself why I am afraid of deploying to production servers its always because I don't fully understand what the deployment process does. If I had to deploy manually I would be lost at sea.
Is it just nievete thinking that enough documentation and training makes that fear go away?
Computer systems are rarely useful on their own. They need to be attached to some other process in order to derive any value from them. Sometimes it's a network, somethings it's a factory, sometimes it's just process run by humans.
In most domains that you attach computers to, it's possible for one person to understand both the computer side of it and the other side of it. Web development is like this, you can easily understand both the web and computer systems, as one is really just another version of the other.
If you're attaching the computer system to another very hard-to-understand system, like, say, a surgical robot, then the person that understands both domains well enough to avoid problems like this is a unicorn, there might well be only one person in the world that's built up expertise in both fields.
To get around this you need careful, effective management of the two pools of labor, and robust dialogue between the two teams. The second this starts breaking down, is the second you start marching down the road to disaster.
In the aforementioned example, everyone would be well-aware of the failure modes. So it's a bit easier to manage. In finance, failure modes can be so subtle, particularly as the system grows more complex, that they can escape detection by both teams unless they're both checking each other's work and keeping each other honest.
Institutional knowledge transfer has to constantly be happening, areas of ignorance on both sides have to constantly be appraised and plans undertaken to reduce said ignorance. The more everyone knows about the entire system, the more likely it will be that critical defects like this can be discovered before they strike.
This kind of effective interaction of those at the bottom can only be organized and directed at the top. It's very much a "captains winning the war"-type situation, but captains can't lead without support from the generals.
Knowledge transfer problems have been a running theme at many of my previous work places, I'm interested in what I can do to help, I'm a documentation proponent but there must be more.
In hindsight, this would still have been preferable to losing $400 million, but quite obviously nobody at the time realized just how catastrophic this was going be.
A reconciliation would be necessary, which would come from where the orders were being sent to (the exchange), but with millisecond delays a realtime dashboard seems only necessary for this case (not that it is a bad case) and while End Of Day reconciliations are needed, I'd be interested if anyone knew of exchange requirements for intra-day trading reconciliations?
That is caused by bad engineering, and they needed to do less of that.
"Realtime dashboard" and "deployment procedures" are more engineering, not less.
But really, the 45 minutes probably flew by faster than you or I could really imagine. You're in a crisis situation, you tell yourself you just need another five minutes to fix something. Five becomes ten, becomes twenty, and before you know it, your company is looking at a $400M nightmare.
And, as has been found in other disasters in other industries, kill switches are hard to test.
He screamed for help, but no one could hear him over the other noisy machinery. Welcome to the land of kill switches.
I encountered something like this about a year ago at work. We were deploying an extremely large new system to replace a legacy one. The portion of the system which I work on required a great deal of DBA involvement for deployment. We, of course, practiced the deployment. We ran it more than 20 times against multiple different non-production environments. Not once in any of those attempts was the DBA portion of the deployment completed without error. There were around 130 steps involved and some of them would always get skipped. We also had the issue that the production environment contained some significant differences from the non-production environments (over the past decade we had, for example, delivered software fixes/enhancements which required database columns to be dropped... this was done on the non-production systems, but was not done on the production environment because dropping the columns would take a great deal of time). Myself and others tried to raise concerns about this, but in the end we were left to simply expect to do cleanup after problems were encountered. Luckily we were able to do the cleanup and the errors (of which there were a few) were able to be fixed in a timely manner. We also benefitted from other portions of the system having more severe issues, giving us some cover while we fixed up the new system. The result, however, could have been very bad. And since it wasn't, management is growing increasingly enamored with the idea of by-the-seat-of-your-pants development, hotfixes, etc. When it eventually bites us as I expect it will, I fear that no one will realize it was these practices that put us in danger.
http://www.amazon.com/Normal-Accidents-Living-High-Risk-Tech...
But more to the point: the conditions in which wildfires are common involve such insanely high risk of conflagration that the least spark can set them off. And do.
When you've got to tell people not to mow lawns or trim brush for fear of stray sparks setting off tinder-dry brush, you're simply sitting on top of (or in the midst of) a bomb. And that is the reality in much of the world -- Australia, the western US, Greece, and elsewhere. Or a hot car exhaust from a parked vehicle. Or broken glass. Or, yes, flame in the form of cigarettes, a campfire, or barbecue.
But except for the case of deliberate arson (which does happen), I find the practice of convicting people for what's essentially a mistake waiting to happen to be quite distasteful.
Even if the deployment was done correctly, during the deployment there would be old and new code in the system.
The rules where things like: - Too many trades in one direction (AKA. big pos) - P/L down by X over Y - P/L up by X over Y - Orders way off the current price
When ever there was a shutdown/pause a human/trader would need to assess the situation and decide to continue or not.
Also your submission should probably have (2014) in the title.
...not to anyone who has worked in financial software
I believe it was this, as it was a Guardian article - which has since been subject to the digital graveyard.
This isn't just a deployment problem. It's a monitoring problem. What mechanism did they have to tell if the servers were out of sync? Manual review is the recommended approach. Seriously? You're going to trust human eyeballs for the thousands of different configuration parameters?
Have computers do what computers do well - like compare complex system configurations to find things that are out of sync. Have humans do what humans do well - deciding what to do when things don't look right.
HFT systems aren't like a bunch of poker players slyly eying one another across a table, they're more like electro-chemical gold miners concentrating gold from the rivers of cyanide sludge pumping up from the financial system mines. Heaven help them if they depolarize.
Maybe it's the same one .....
- They had dead code in the system
- They repurposed a flag for a previous functionality
- They (apparently) didn't had code reviews
- They didn't had a staging environment
- They didn't had a tested deployment process
- They didn't had a contingency plan to revert the deploy
It could be minimized or avoided altogether by fixing just one of the points. Incredible.
I don't get that. There was no code issue. The old and new code both worked as intended, it was a deployment and deployment-verification problem.
> They didn't had a staging environment
Yes they did. They staged the new code and tested it. They did a slow deployment also.
> They didn't had a contingency plan to revert the deploy
They did revert the deploy within the 45 minutes. It made it worse.
I think you need to re-read the article. Your assessment is strange given the event.
A code review could raise the issue of repurposing a flag in case they had to revert the deploy. Changing the semantics of a flag is a big no-no anyway, and there are ways to guard against that.
> Yes they did. They staged the new code and tested it. They did a slow deployment also.
But they didn't had a staging environment that matched their live environment, apparently. You want a staging environment that is 1:1.
> They did revert the deploy within the 45 minutes. It made it worse.
If you think reverting a deploy by simply pushing an older version is the same as a contingency plan, think again.
Being so removed from binary and bit level interactions it can be easy to forget things like this.
I think the best-practices they violated is that they deprecated and repurposed a flag within a single release cycle. That sort of activity should take two release cycles at least, one to remove the old functionality and one to add the new functionality.
The value of a good dev is a realised only when someone screws up.