【问题标题】:Is it possible to increase the stack size in CEF/CefSharp?是否可以增加 CEF/CefSharp 中的堆栈大小?
【发布时间】:2019-03-23 16:19:22
【问题描述】:

我在 C# 项目中将 cef.redist.x86.3.3497.1840 与 CefSharp 一起使用。我有一组播放 mp3 音频的 HTML 页面,它们在 Chrome 中运行良好,但是当我尝试使用 CEF/CefSharp 加载它们时,视觉效果还可以,但 CEF/CefSharp 给了我信息

"Uncaught RangeError: Maximum call stack size exceeded"

这发生在我什至尝试播放音频之前(顺便说一句,在这种情况下不会播放),即使我可以加载单个 .mp3 文件并使用 CEF 提供的 HTML5 gizmo 播放它们。

在 Chrome 中使用这些页面时,我从来没有遇到过任何问题。

CEF/CefSharp 堆栈发生了什么?

我可以告诉它使用更大的堆栈吗?

我需要自己用更大的堆栈重建它吗?

CefSharp.MinimalExample.WinForms 的 64 位发布和调试版本都会产生相同的堆栈溢出消息。

【问题讨论】:

  • 如果存在无限递归,通常会发生该异常,这可能是由于错误。如果是这样,增加堆栈大小只会改变到达那里需要多长时间。它必须设置得非常低才能在正常操作中引起问题(20 或更少)。
  • 它是否在 64 位版本中重现?您可以使用github.com/cefsharp/CefSharp.MinimalExample 进行测试
  • @Christopher:如果是无限递归,Chrome 不也会发生这种情况吗?或者,也许您指的是 CEF 中的错误,而不是我的 JS?
  • @M.Robinson:每个浏览器都有不同的代码来处理每种格式。每个浏览器处理轻微损坏/不正确格式的方式不同。仅仅因为它将 CEF/CefSharp 的某些部分放入无限递归中,并不意味着它对 Chrome 也有同样的作用。这就是为什么我们使用不同的浏览器来测试东西。以及为什么我们必须使用不同的浏览器来测试东西。

标签: c# html stack mp3 cefsharp


【解决方案1】:

我确实使用以下网站复制了 x86 和 x64 版本:
https://pass.carrefour.es/zona-cliente
https://online.bankofcyprus.com/netteller-web/
使用基于 C++ CEF 的项目。 (我认为当时是 CEF 分支 3282 - Chrome v60)。

如果我没记错的话,这个也是用cefclient转载的。
这个问题确实是由非常大的 javascript 代码最终进入页面触发的。

我所做的是增加 .vcxproj 中的堆栈大小:

<StackReserveSize>0x00120000</StackReserveSize>

(所以在默认 1 MB 的基础上增加 128 KB)。

NodeJS 有一个名为--stack_size 的--v8-option,听起来很相似,但我不知道CEF 中是否有类似的东西(至少我不记得直接暴露了)。

我当时对修复的评论是:

Increase stack size from the default 1MB adding 128 KB more. 
This seems to be necessary for renderer's V8, which is trashing 
the page guard instead of raising JS RangeError or stack overflow, 
but blows up with STATUS_GUARD_PAGE_VIOLATION or STATUS_STACK_OVERFLOW *and* 
overwriting the first frame. 

The debugger itself is defeated since there is no context to determine which 
10000+ lines JS blows up the parser.

我不确定为什么 V8 会以这种方式运行(我可能完全错了,因为它是对多个支持问题的关键修复,我只是使用了更多的试错方法而不是彻底的调试)。

为方便起见,以下是报告的错误(已编辑):

[*edited*] webpage crashes if you access https://pass.carrefour.es/zona-cliente
We have internal repro 100%.

If you access the webpage https://online.bankofcyprus.com/netteller-web/ in [*edited*], the tab crashes unexpectedly:

"The webpage has quit unexpectedly. The problem may have been caused by an exception, or another exceptional condition such as blocking scripts or requests generated by the webpage.
Please Reload page or go Back to the previous page."
We have internal repro. Full dump can be found here: *edited*

可能相关的问题: V8
https://bugs.chromium.org/p/v8/issues/detail?id=8234
https://bugs.chromium.org/p/v8/issues/detail?id=8053
https://bugs.chromium.org/p/v8/issues/detail?id=6617
https://bugs.chromium.org/p/v8/issues/detail?id=6438

铬:
https://bugs.chromium.org/p/chromium/issues/detail?id=753705

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-22
    • 2010-11-24
    • 2013-03-15
    • 2021-03-15
    • 2015-12-11
    • 2017-03-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多