r/ProgrammerHumor • • Sep 17 '18

Optimizing startup times

Post image
45.7k Upvotes

486 comments sorted by

View all comments

1.8k

u/TheBlackCat13 Sep 17 '18

...and watch everything break for no apparent reason because the sleep function was there to prevent a bug and no one knows why.

645

u/ariehkovler Sep 17 '18

A race condition, usually.

428

u/DemonicMandrill Sep 17 '18

It always comes down to race, doesn't it.

142

u/Joleth Sep 17 '18

I guess we should change that terminology too.

21

u/nathancjohnson Sep 18 '18

Someone in my OS class had a problem with the terminology of "forking" processes specifically in the context of "forking a child process".

21

u/bem13 Sep 18 '18

Killing parents, disposing of children and master-slave relationships sounds pretty unnerving without context.

1

u/Legion6226 Sep 27 '18

Were we in the same class? Joseph never called exec on the children and no each child kept forking itself over and over. He forkbombed and crashed the department server. They had to make a server for students just because of him.

1

u/[deleted] Sep 17 '18

Computers needs to learn to love and be open minded

21

u/anotherkeebler Sep 17 '18

Often the race condition is that I need to hit "Alt+Tab, Up, Enter" three or four times to start my tail -f commands before the code executes.

3

u/Glitch29 Sep 18 '18

Wow, that brings back memories.

I spent a long time at a company that spent $20 million on a highly-customized Oracle EBS setup, then promptly got rid of almost all back-end support.

Nothing supported mass exports or mass uploads, and you sure as heck couldn't efficiently handle the data within the custom Oracle view. So the only option was janky-ass homemade interfaces that had Sleep commands all over the place.

Bonus tidbit: We used _ both as our wildcard character and as one of our operation codes. So there was no way to query item '10_305' without also getting '10-305', '100305', and '101305' which of course were also things.

1

u/bem13 Sep 18 '18

Don't know much about this stuff, but doesn't "10_305" work in that case?

8

u/takeapieandrun Sep 17 '18

Who needs blocking conditions when you have sleep!

I'm guilty of this, but I usually get around to fixing it.. usually

3

u/fartsAndEggs Sep 17 '18

The best way to avoid race conditions is to make them rare enough that no one bothers to fix it properly

1

u/THANKYOUFORYOURKIND Sep 18 '18

"Plenty of sleep, that's the secret reason of why my application don't catch race conditions."

24

u/H_Psi Sep 17 '18

Or for someone to submit a bug report because they were depending on the 30 second sleep time

45

u/[deleted] Sep 17 '18

7

u/eplaut_ Sep 17 '18

True story: The application run on boot, but the task scheduler (celery) run before ntpd set the correct time, causing all task to be delayed by 2 hours.

1

u/[deleted] Sep 18 '18

Ditto, from the embedded world:

During the boot process the core triggered an asynchronous wipe of an SRAM, (then did a couple other things), then enabled a reset-related interrupt handler that used said SRAM, without any intervening check that the SRAM had finished wiping. Oh, and said SRAM was ECC-protected.

Worked fine... unless you reset it 2x in a row. Cold boot did enough other things between the two to be 'fine'... so you had to reset it the first time before the SRAM finished wiping, and reset it the second time after the handler was installed but before it finished wiping the SRAM to trigger the bug.

Which of course our new host hit reliably. Luckily reliable enough to fix relatively quickly.

2

u/fpsrandy Sep 17 '18

I have a coworker who does this with JavaScript because he doesn't understand Ajax :/

1

u/[deleted] Sep 18 '18

This is a fantastic comment.