<p>Say you compile your app with <code>go build</code>. You got yourself a go executable. What do you think could happen if you take this go binary and execute it on another computer (both running Linux) but with lesser computing power and cores?</p>
<p>Reason why I asked is that something bizarre just happened to me. I have a 10-year-old PC laying around which I have been using as some sort of a home server. It has AMD Athlon 64 X2 dual core with 2GB of RAM. Ancient but it's still running. I installed Ubuntu 16.04 on it, and it's running all kinds of modern apps like Go and Docker. Trendy old chap.</p>
<p>It had been running for weeks without any crashes. It's even running some background jobs doing stuff in both go and ruby. So today, I compiled another go app of mine on my technologically superior laptop, copy-and-pasted it to my trusty ol' server, and configured the cronjob to run it periodically like the milkman.</p>
<p>I was tailing -f the log file from my new app to make sure that the cronjob was indeed running. All was running fine and dandy. 30 minutes later I checked back the log, and noticed that it hadn't moved one bit while it should've finished 20 minutes ago. I thought to myself "damn, this server is old". I pressed Ctrl+C, and that's when I realized that it had crashed. I rebooted my server, and that's also when I noticed that it had gone dead. Hooked up a monitor to it, it didn't even show a thing, not even BIOS. It's dead. Done. Well done, not a single sunny day ever to be seen by this old veteran anymore.</p>
<p>I am dumbfounded now. What the hell. I had copy-pasted a go binary compiled on a machine and had it run on a completely different machine, and it was fine. I thought that's one of the benefits of using Go that the compiled binary is smart enough that you can deploy it across any architecture, as long as it's Linux, and it will run. Unless I misunderstood? Did I just run into a Great Bug? Or, did the universe just decide to fuck with me tonight?</p>
<hr/>**评论:**<br/><br/>drvd: <pre><p>Go executables on Linux require a decent new glibc and that's it (well kinda, depending on DNS lookup in net). If it is there it will run, if not, not.</p>
<p>Probably your machine just died.</p></pre>lost_fogs: <pre><p>My best guess would be that your server just coincidentally died of natural causes. Recommend performing an autopsy.</p></pre>cjbprime: <pre><p>Your machine coincidentally died.</p></pre>DualRearWheels: <pre><p>Go sucked the life out of your machine.
Joke aside, I run linux and windows statically compiled executables on all sort of OS's (win xp, 7, 8, 10... centos, ubunty, mint), and only problem I found that sometimes when running on newest linux kernels strange panics happen with some libraries (mysql connector etc.)</p></pre>carsncode: <pre><p>Correlation != causation. If there is a way for a Go binary to wreck your machine so bad it won't even POST, I'd be seriously impressed.</p></pre>ericzhill: <pre><p>Bad cap in the power supply. Huge issue with counterfeit caps in that era. Replace any bulging caps in it for about $10 and it should be good to go.</p></pre>titpetric: <pre><p>Never in my life has it been suggested that I should replace caps, and I'm not sure if it's $10 per cap or total. Had I known, my trusty Cyrix 200Mhz might still be heating my apartment in the clutches of winter.</p></pre>ericzhill: <pre><p>There's a good article on those crap capacitors at Wikipedia: <a href="https://en.m.wikipedia.org/wiki/Capacitor_plague" rel="nofollow">https://en.m.wikipedia.org/wiki/Capacitor_plague</a></p>
<p>We started replacing caps in failing power supplies and motherboards to avoid buying all new. I think at one point Dell actually replaced some 1000 plus desktop motherboards at the company I worked for trying to fix this issue. After we traced it to caps, we purchased a few boxes of caps and just did it ourselves.</p></pre>titpetric: <pre><p>By the time the caps usually puff up the hardware was usually so outdated that an upgrade was a better option. That 200MHz cryix today is laughable compared even to a raspberry pi.</p></pre>titpetric: <pre><p>I'm going to go with the universe lighting some candles, trying to make the mood sensual before making sweet love to the transistors of your ancient hardware. Sparks were in the air, you could cut the sexual tension with a knife. But the universes gentle kiss was too much. Alas, your hardware is in deaths hands now - but at least it died happy, knowing, feeling.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传