Live data from Hacker News

Docker for Windows won't run if Razer Synapse driver management tool is running

twitter.com

1–10 of 191 posts

Re: Docker for Windows won't run if Razer Synapse driver management tool is running

#2
If you're going to copy-paste code from Stack Overflow and deploy it to millions of users' systems, I think you have some responsibility to understand what the code is doing.

I can totally see how this happened, and I would definitely not say that I would never make this mistake, especially under time pressure etc. But a careful programmer would a) desire to understand what the code did, and thus spend enough time reading it to spot the `GetType()`, and b) test that the "prevent more than one instance from running" behaviour worked properly, which would involve both testing that you can't run two instances of the program, and testing that if you change the assembly identifier, you can run two instances.

Re: Docker for Windows won't run if Razer Synapse driver management tool is running

#4
post #3

What am I looking for in the screenshot ?

You would sadly have to find your way through the Twitter "thread" to fully understand.

Someone at Docker and someone at Razer both copy-pasted the same faulty code from Stack Overflow for preventing multiple instances of their program running at once. Unfortunately the code took the assembly identifier and called GetType() on it which returns the same value for all programs.

The Stack Overflow answer was later fixed but since the programmers no doubt both felt they'd "solved" the problem, they didn't see the fixed answer.

Re: Docker for Windows won't run if Razer Synapse driver management tool is running

#5
post #3

What am I looking for in the screenshot ?

Nothing. The screenshot is meaningless. The story is in the twitter comments underneath.

> Both programs want to ensure you only run one copy of themselves. So they create a global mutex using the GUID of their .NET assembly, right?

> So what happens is that both of them are creating a global mutex to ensure only one copy runs, but instead of basing the GUID on their own code, they're both using the GUID of a part of .NET itself. > And they're using the same one!

> Back in 2009, the user "Nathan" asked how to get the GUID of the running assembly. Twelve minutes later, "Cerebrus" answered. And that answer was wrong.

> A year and a month later, it was pointed out (by "Yoopergeek") that it gives the wrong GUID.

> Three years later, Cerebrus returns and fixes the answer. They can't delete it, because it was accepted

> That flawed stackoverflow post is here: https://stackoverflow.com/questions/502303/how-do-i-programm...

Re: Docker for Windows won't run if Razer Synapse driver management tool is running

#6
Ha, stackoverflow is a great tool, but... the more answers I see on an area I’m experienced in, the more I realize how wrong they can be. Sure, the answer usually gets the job done, but everything else about it might not be right.

If I need to use stackoverflow, these days I make sure I do a few things:

- read a number of answers, comments included. Just because an answer is accepted doesn’t mean it’s the best one

- read API docs for anything I’m unfamiliar with, and make sure I understand how the solution works

- never copy paste; instead use the general idea or concept to rewrite a solution in a safe, future proof manner

- if an answer works but doesn’t feel like the right solution, be prepared to do my own research to find a better approach

Hopefully this results in a better engineered product, but one of the main benefits is learning and expanding knowledge of APIs/techniques.

Re: Docker for Windows won't run if Razer Synapse driver management tool is running

#7
When I need to ensure only one copy to run I never used GUID, I always used some combination of project name + my name + current date + customer name/business. This way is unique and with a personal touch. Also you can make it as long as you want up to MAX_PATH, not the short style that GUID does it.

Re: Docker for Windows won't run if Razer Synapse driver management tool is running

#8
post #3

What am I looking for in the screenshot ?

You would sadly have to find your way through the Twitter "thread" to fully understand. Someone at Docker and someone at Razer both copy-pasted the same faulty code from Stack Overflow for preventing multiple instances of their program running at once. Unfortunately the code took the assembly identifier and called GetType() on it which returns the same value for all programs. The Stack Overflow answer was later fixed…

Which I suppose is an argument that pulling in eleventy thousand oneliners from npm is better than copying oneliners using the editor: At least you can run a batch upgrade without spending real brain cycles.

I'm sure someone has written a thingy to upgrade npm dependencies, rerun tests, and bisect to tell you about the breaking upgrade if anything reaks.

Left-pad, come back, all is forgiven.

Re: Docker for Windows won't run if Razer Synapse driver management tool is running

#9

When I need to ensure only one copy to run I never used GUID, I always used some combination of project name + my name + current date + customer name/business. This way is unique and with a personal touch. Also you can make it as long as you want up to MAX_PATH, not the short style that GUID does it.

Sounds like a natural primary key.

Re: Docker for Windows won't run if Razer Synapse driver management tool is running

#10
> homework assignment for all programmers reading this thread: Think about how you'd find this bug in your own programs. You copy/paste the code, it seems to work, and you don't realize it's broken because you don't run either of these programs which made the same mistake.

Wait... WHAT??

Who the hell copy pastes code into their program without first examining and understanding what each step is actually doing, how and why the pieces fit together as they do, and how it works as a whole to solve the problem?

Post reply on HN