From: Michael Geary Date: 2004-06-12T19:23:39+09:00 Subject: Re: The dangers of sleeping ... > Dale Martenson wrote: > > This problem came up as part of a large ruby server application > > where an operator noticed the time on the server was way off and > > set the clock back a couple of hours to correct the problem. The > > system locked up. Threads using the sleep function never woke up. Ben Giddings wrote: > There's your problem. > > See, the thread should more properly be titled 'the dangers of > messing with the clock on a running system'. > > Take a look at the NTP RFCs. They go to enormous pains to slew > the clock, rather than stepping it. If you ever move a computer's > clock backward, expect crazy things to happen. Moving it forward > suddenly isn't good, but it isn't nearly as dangerous. > > This doesn't mean this isn't a bug, and it doesn't mean that software > shouldn't be written with the possibility of this happening in mind, > but it's really the fault of the person running the system. If you > essentially 'mess with causality' you should expect things to break. Ben, do your customers really let you talk to them that way? :-) I can just picture myself telling a customer, "Don't ever change the system clock by more than a few seconds when you're running my application. If you mess with causality like that, you should expect things to break, and it's really your fault." Maybe you can get away with it, but I'd be scared to even try! That customer will run away looking for someone who can write *reliable* code. If I tell them it's not really a bug, that it only happens because I use this cool programming language that uses the most portable APIs, they'll say, "Huh? *Your* program has a bug. Are you going to fix it or not?" So I figure I'd better see it their way if I want to stay in business... :-) -Mike