Skip to content

回复:Linux——失效的套接字问题 ​

首次公开证据

打开首次公开证据
查看 1 个交叉存档
来源说明

Published on GitHub in February 2024 as part of Martti Malmi's testimony in the COPA v. Wright trial

我明白发生了什么。你的所有套接字不知怎么都失效了。你没有与网络通信,但因为有 8 个僵尸连接,它以为自己仍然在线,并继续生成区块。出现这种情况时,你会看到区块连续编号,中间没有插入其他人的区块,例如:

2/未确认

3/未确认

4/未确认

5/未确认

6 个区块

7 个区块

像这样连续 6 个区块都只有你找到了,这不太可能。

你退出并重启后,它连接上了网络,下载了你离开期间网络找到的 45 个区块。由于你的区块没有立即广播到网络,网络在没有它们的情况下继续前进了。

听起来你在 Wine 上遇到的也是完全相同的问题。显然,Linux 上的套接字处理存在某种问题,无论采用哪种方式都会受影响。

我会开始研究这个问题。最终,如果找不到问题根源,我就必须设计某种机制来监测是否长时间没有消息,并断开连接。你目前唯一的变通办法是更频繁地退出并重启。

除一个之外,你的所有节点连接都同时失效了,剩下的一个也在不久后失效。IRC 仍然正常工作,所以并不是你断开了互联网连接。

我在想,区块状态是否应该一直显示“#/未确认”,直到成熟为止(119/未确认,然后变为 120 个区块)。这个数字对于区块的意义不像对于交易那么大。

我认为不把自己的区块计为确认会是一项改进。缺点是不同节点显示的状态数字会不一致。状态数字也不再与区块的成熟倒计时相协调。一个较温和的方案是,仅在所有确认都来自你自己时进行特殊处理。

我刚刚损失了 6 组正在成熟的比特币!我原本有 10 组比特币正在成熟。最后一组大约在 0:22 生成。它达到 2/未确认后,比特币就卡住了。10:10 时,0:22 生成的比特币仍然只有 2/未确认。因为你告诉过我不会丢币,所以我关闭并重启了比特币。好的一面是,它关闭和启动得非常顺利。但不幸的是,区块更新后,我丢失了 6 组比特币。其中 4 组仍未确认,但 2 组已经确认。现在完全没有它们的痕迹。既然你现在提供了“显示生成的新币”选项,也许可以把失败的比特币生成放回来。我只是不喜欢这些比特币凭空消失。我目前仍在运行 Linux 构建,但现在 Wine 版本突然显得有吸引力多了,因为我过去 24 小时生成的 10 组比特币中有 6 组凭空消失了。我附上了 debug.log。

Linux 构建在过去 20 小时内生成了相当数量的比特币,我相信你关于数据库错误的说法,所以一切迹象都表明我今后会运行 Linux 构建。Linux 构建唯一有点烦人的地方是,我电脑的风扇从 50% 变成了 100%。😛 我知道可以限制 CPU,所以如果它太让我烦恼,而且我能接受生成较少的比特币,也许会这么做。或者我只是需要开始多听点音乐…… ...

               在还有未确认项时关闭没有风险。
        当你创建交易或新区块时,它会立即
               向网络广播。之后,逐渐增加的“#/已确认”数字只是监控结果。
         在这段时间里,你的节点没有任何操作可以促进
        接受。

英文原文 ​

展开英文原文

I see what happened. All your sockets went dead somehow. You had no communication with the network, but because you had 8 zombie connections, it thought it was still online and kept generating blocks. You can tell this is happening when your blocks are numbered sequentially, without other people's blocks interspersed, like:

2/unconfirmed

3/unconfirmed

4/unconfirmed

5/unconfirmed

6 blocks

7 blocks

It's implausible that you would be the only one to find blocks for 6 blocks in a row like that.

When you exited and restarted, it connected and downloaded 45 blocks that the network found in your absence. Since your blocks were not broadcast to the network immediately, the network went on without them.

It sounds like you had exactly the same problem on Wine. There's clearly something about socket handling on Linux that's effecting it either way.

I'll start researching this. Ultimately if I can't find the root of the problem, I'll have to make some kind of mechanism to watch for an absence of messages and disconnect. The only workaround for you right now would be to exit and restart more often.

All but one of your node connections went dead at the same time, one shortly after. IRC was still working, so it wasn't that you were offline from the internet.

I wonder if the status of blocks should say "#/unconfirmed" all the way up to maturity (119/unconfirmed then 120 blocks) instead. The meaning of the number isn't as strong for blocks as for transactions.

I think it would be an improvement not to count one's own blocks as confirmations. A drawback would be that the status numbers shown by different nodes would not match. The status number would no longer be coordinated with the maturity countdown on blocks either. A lighter option would be a special case only if all confirmations are your own.

I just lost 6 sets of maturing coins! I had 10 sets of bitcoins maturing. The last set was generated at about 0:22. It got to 2/unconfirmed before bitcoin got stuck. At 10:10, the bitcoin which was generated at 0:22 was still only at 2/unconfirmed. Since you had told me that I wasn't going to lose coins, I shutdown and restarted bitcoin. On the bright side, it shutdown and started up very smoothly. But unfortunately, when the blocks updated, I lost 6 sets of bitcoins. Four sets were still unconfirmed, but two sets were confirmed. And there's no trace of them now. Perhaps now that you have the 'Show Generated Coins' option available, you can put back in failed bitcoin generations. I just don't like that those bitcoins just disappeared into thin air. I'm still running the Linux build at the moment, but the Wine version is suddenly looking much more attractive now that 6 out of the 10 sets of bitcoins I generated in the past 24 hours just vanished. I've included my debug.log.

The Linux build has generated a decent amount of bitcoins within the past 20 hours and I trust what you're telling me about database errors, so all signs point toward me running the Linux build from now on. The only half annoying thing about the Linux build is that my computer's fan has gone from 50% to 100%. 😛 I know I can limit the CPU, so if it gets on my nerves too much and if I can live with less bitcoins being generated, perhaps I'll do that. Or maybe I just need to start listening to more music... ...

               There's no risk in shutting down while there are
        unconfirmed.
                When you make a transaction or new block, it immediately
               broadcasts it to the network.  After that, the increasing
               #/confirmed number is just monitoring the outcome.
         There's
               nothing your node does during that time to promote
        the acceptance.

为历史保存,为中文读者整理。每篇档案均附来源与英文原文。