Martti Malmi 通信

回复:linux-0.1.6-test7

中本聪 · 2009 年 11 月 18 日

SN-10114 附来源、原文与上下文。

阅读语言

总算有个容易的问题了。我看出,在首次下载这样的长时间操作中,有一种情况会导致它发生。TryLock 错误与数据库问题无关。修复会包含在 test8 中。

Finally an easy one. I see a way that could happen on a long operation such as the initial download. The TryLock bug is unrelated to the db stuff. Fix will be in test8.

我现在已在 32 位 linux 上,通过持续不断的大量请求,成功重现了 3 次 db::open/close 异常。看来即使只是为了写盘而定期关闭 wallet.dat 数据库,也会出现 db::close 异常。我正在禁用 Linux 上的钱包写盘功能。在 Linux 上,直到准备退出,我们都不会关闭数据库句柄。目前禁用后还没有异常。

I've been able to reproduce the db::open/close exception 3 times now on 32-bit linux by hitting it with a continuous flood of non-stop requests. It looks like even periodically closing the wallet.dat database to flush it gets the db::close exceptions. I'm disabling the wallet flush feature on Linux. On Linux we'll never close a database handle until we're ready to exit. So far with this disabled, no exceptions.

我也在实现有序的首次区块下载。不再直接一次请求所有区块,而是每次请求一批 500 个。这样就能在重试超时之前收到区块,除非确实没收到或速度太慢,否则不应再向其他节点请求。改动在被请求方,所以只有首次下载区块的来源节点使用了新版,才能看到这个功能。

I'm also implementing the orderly initial block download. Instead of naively requesting all the blocks at once, it'll request batches of 500 at a time. This way, it'll receive the blocks before the retry timeout, so it shouldn't go requesting it from other nodes unless it actually doesn't receive them or it's too slow. The change is in the requestee's side, so this functionality won't be visible until your initial block download is coming from a node that has the new version.

发送 test8 之前,我会再多测一会儿。

I'm going to test this some more before sending test8.

引用 New Liberty Standard 的文字New Liberty Standard来源 ↗

我用一个全新数据目录启动了 test7。区块下载开始得快多了。只花了大约 15 秒,之前 Linux 构建要等几分钟。下载区块期间崩溃了一次,终端显示以下消息。

I started with a fresh data directory with test7. Blocks started to download much faster. It only took about 15 seconds where it took a few minutes previously with the Linux build. It crashed once while it was downloading blocks with the following message in the terminal.

../include/wx/thrimpl.cpp(50): assert "m_internal" failed in TryLock(): wxMutex::TryLock(): not initialized [in child thread] Trace/breakpoint trap

../include/wx/thrimpl.cpp(50): assert "m_internal" failed in TryLock(): wxMutex::TryLock(): not initialized [in child thread] Trace/breakpoint trap

我附上了日志文件,不过重启 bitcoin 前忘了备份,所以不确定崩溃发生在日志中的哪一处。

I've included my log file, but I forgot to back it up before restarting bitcoin, so I'm not sure at what point in the log file the crash occurred.

幸好还没遇到段错误。之前几个构建中,段错误的发生频率波动相当大,所以我会继续运行,遇到问题再告诉你。

Fortunately I haven't encountered the segmentation fault yet. The frequency of segmentation faults in the previous builds varied quite a bit, so I'll keep running it and let you know if i run into any problems.

引用中本聪此前的文字中本聪来源 ↗

test 7:

test 7:

运行之前备份数据目录,以防万一。

Backup your data directory before running this, just in case.

这是针对 Db::open/Db::close“Bad file descriptor”异常的变通办法。也可能会加快首次区块下载。办法是打开数据库句柄,然后在程序运行期间一直保持打开,其实这本来就是更常见的做法。如果不再一直关闭又打开,错误应该就没有机会发生。

Workaround for the Db::open/Db::close "Bad file descriptor" exception. Might also make the initial block download faster. The workaround is to open the database handles and keep them open for the duration of the program, which is actually the more common thing to do anyway. If we're not closing and opening all the time, the error shouldn't get a chance to happen.

唯一例外是 wallet.dat,我仍然会在写入完成后关闭它,这样才能把事务日志写入 dat 文件,让 dat 文件可以独立使用。这样,如果有人在比特币运行时备份,就会得到一份不需要数据库事务日志、本身就有效的 wallet.dat。

The one exception is wallet.dat, which I still close after writing is finished so I can flush the transaction logs into the dat file, making the dat file standalone. That way if someone does a backup while Bitcoin is running, they'll get a wallet.dat that is valid by itself without the database transaction logs.

这次重新组织了数据库处理方式,所以可能会发现一些新的死锁。通常,如果发生死锁,界面会停止重绘,或者虽然仍显示“正在生成”,却不再使用 CPU。

This is a restructuring of the database handling, so we might find some new deadlocks. Usually if it deadlocks, either the UI will stop repainting, or it'll stop using CPU even though it still says Generating.

来源

阅读字号

选择适合你的字号,之后阅读会继续使用。