在 MediaWiki 中使用 mwlib 将大量文章呈现为 PDF 失败

发布于 2024-10-06 17:56:42 字数 333 浏览 0 评论 0原文

我已经安装了 Mediawiki Collection Extension 和 mwlib 以将文章(或文章集合)呈现为 PDF。这对于单篇文章和最多 20 篇文章的集合非常有效。

当我渲染较大的集合时,解析页面中的百分比计数器(渲染成功时计数为 100%)停留在 1%。

查看 mwrender.log,我看到错误 32 - 管道损坏错误。上网查了一下,错误32可能是由于接收进程(管道后面的部分)崩溃或无响应造成的。

从这里开始就很难继续下去了。我应该去哪里寻找更多线索?难道是与 MySQL 服务器的连接中断了?

整个应用程序在交钥匙 Linux Mediawiki VM 上运行。

I have installed the Mediawiki Collection Extension and mwlib to render articles (or collections of articles) to PDF. This works very well for single articles and collections with up to 20 articles.

When I render larger collections, the percentage counter in the parsing page (which counts to a 100% when rendering succeeds) is stuck at 1%.

Looking at the mwrender.log I see an Error 32 - Pipe Broken error. Searching the internet reveals that Error 32 can be caused by the receiving process (the part after the pipe) crashing or not responding.

From here it is hard to proceed. Where should I look for more clues? Could it be the connection to the MySQL server that dies?

The whole applicance is running on a Turnkey Linux Mediawiki VM.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情绪 2024-10-13 17:56:43

我正在使用 PDF 导出扩展,它适用于 20 多篇文章。也许尝试一下?

I'm using PDF Export Extension and it works with more than 20 articles. Maybe try that?

爱本泡沫多脆弱 2024-10-13 17:56:43

我自己找出了问题所在。

Mw-render 为集合中的每篇文章生成并行请求。这意味着对于 50 个页面的集合,会同时发出 50 个请求。 Apache 可以处理这个问题,但 MediaWiki 的 MySQL 数据库则不行。

您可以使用 --num-threads=NUM 选项限制 mw-render 生成的线程数量。我找不到 mw-serve 调用 mw-render 的位置,因此我只是将 Apache 可以生成的最大线程(工作线程)数量限制为 10。

如果第一个失败,mw-render 会自动重复对文章的请求,因此这种方法有效。

我在 4 分钟内渲染了一个包含 185 篇文章的 PDF,生成的 PDF 有 300 多页。

I figured out the problem myself.

Mw-render spawns a parallel request for every article in a collection. This means that for a collection of 50 pages, 50 simultaneous requests are made. Apache could handle this, but not the MySQL db of MediaWiki.

You can limit the amount of threads that mw-render spawns with the --num-threads=NUM option. I couldn't find where mw-serve calls mw-render, so I just limited the maximum amount of threads (workers) Apache could spawn to 10.

mw-render automatically repeats requests for articles if the first ones fail, so this approach worked.

I rendered a PDF with 185 articles within 4 minutes, the resulting PDF had 300+ pages.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文