Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 偶现崩溃 #5169

Open
2 tasks done
Aobanana-chan opened this issue May 30, 2024 · 17 comments
Open
2 tasks done

[Bug]: 偶现崩溃 #5169

Aobanana-chan opened this issue May 30, 2024 · 17 comments
Labels
bug Something isn't working

Comments

@Aobanana-chan
Copy link

预期情况

正常运行

实际情况

无提示地崩溃了

复现方法

并无稳定复现方式, 凭感觉通常发生于打开qbittorrent之后。

日志信息

日志一直不正常工作, 每个log都记录差不多记录这么点内容
2024-05-30 00:33:38.3534-INFO Current_SessionEnding
2024-05-30 00:33:38.4110-INFO MyAppExit Begin
2024-05-30 00:33:38.5002-INFO MyAppExit End
2024-05-30 22:04:22.9966-INFO v2rayN start up | v2rayN - V6.45 - 2024/05/18 | C:\Users\Aobanana\Desktop\v2rayN-With-Core\v2rayN.exe
2024-05-30 22:05:23.8229-INFO UpdateTaskRunSubscription
2024-05-30 22:06:23.8198-INFO UpdateTaskRunGeo
2024-05-30 22:12:58.0874-INFO v2rayN start up | v2rayN - V6.45 - 2024/05/18 | C:\Users\Aobanana\Desktop\v2rayN-With-Core\v2rayN.exe
2024-05-30 22:13:58.4607-INFO UpdateTaskRunSubscription
2024-05-30 22:14:58.4602-INFO UpdateTaskRunGeo

以下是来自系统日志的堆栈:
Application: v2rayN.exe CoreCLR Version: 8.0.23.53103 .NET Version: 8.0.0 Description: The application requested process termination through System.Environment.FailFast. Message: 不可恢复的系统错误。 Stack: at System.Environment.FailFast(System.String) at System.Windows.Controls.TextBoxView.ArrangeVisuals(System.Windows.Size) at System.Windows.Controls.TextBoxView.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.ContextLayoutManager.UpdateLayout() at v2rayN.Views.MsgView.AppendText(System.String) at DynamicClass.InvokeStub_Action1.Invoke(System.Object, System.Span1<System.Object>) at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) at System.Delegate.DynamicInvokeImpl(System.Object[]) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at v2rayN.App.Main()

额外信息

No response

我确认已更新至最新版本

我确认已查询历史issues

@Aobanana-chan Aobanana-chan added the bug Something isn't working label May 30, 2024
@2dust
Copy link
Owner

2dust commented Jun 2, 2024

把日志关闭,同时把信息栏的自动刷新关闭
然后正常使用一段时间,观察是否会再次发生

@2dust 2dust closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2024
@Aobanana-chan
Copy link
Author

image
确实没稳定的复现方式, 今日连续崩溃两次...
都是在后台没开窗口的情况下, 自己崩的(每次打开自动刷新都会打开, 经常忘记关, 不太清楚是否有效)
没用过WPF, 但以个人从其他UI框架的理解来看, 在后台, 窗口没打开的情况下, UI元素应该都不存在才对, 为啥会进行对TextBoxView的对齐操作

@2dust
Copy link
Owner

2dust commented Jul 7, 2024

windows错误日志发出来看看

@Aobanana-chan
Copy link
Author

windows错误日志发出来看看

第一次

Application: v2rayN.exe CoreCLR Version: 8.0.23.53103 .NET Version: 8.0.0 Description: The application requested process termination through System.Environment.FailFast. Message: 不可恢复的系统错误。 Stack: at System.Environment.FailFast(System.String) at System.Windows.Controls.TextBoxView.ArrangeVisuals(System.Windows.Size) at System.Windows.Controls.TextBoxView.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.ScrollContentPresenter.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Grid.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.ScrollViewer.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Grid.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Grid.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Grid.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Border.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Documents.AdornerDecorator.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Grid.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Control.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.DockPanel.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at MS.Internal.Helper.ArrangeElementWithSingleChild(System.Windows.UIElement, System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Border.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Control.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Grid.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.DockPanel.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Grid.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at MS.Internal.Helper.ArrangeElementWithSingleChild(System.Windows.UIElement, System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Grid.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Control.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at MS.Internal.Helper.ArrangeElementWithSingleChild(System.Windows.UIElement, System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Documents.AdornerDecorator.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Controls.Border.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.Window.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.ContextLayoutManager.UpdateLayout() at v2rayN.Views.MsgView.AppendText(System.String) at DynamicClass.InvokeStub_Action1.Invoke(System.Object, System.Span1<System.Object>) at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) at System.Delegate.DynamicInvokeImpl(System.Object[]) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at v2rayN.App.Main()

第二次

Application: v2rayN.exe CoreCLR Version: 8.0.23.53103 .NET Version: 8.0.0 Description: The application requested process termination through System.Environment.FailFast. Message: 不可恢复的系统错误。 Stack: at System.Environment.FailFast(System.String) at System.Windows.Controls.TextBoxView.ArrangeVisuals(System.Windows.Size) at System.Windows.Controls.TextBoxView.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.ContextLayoutManager.UpdateLayout() at v2rayN.Views.MsgView.AppendText(System.String) at DynamicClass.InvokeStub_Action1.Invoke(System.Object, System.Span1<System.Object>) at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) at System.Delegate.DynamicInvokeImpl(System.Object[]) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at v2rayN.App.Main()

@TPtreehole
Copy link

image 确实没稳定的复现方式, 今日连续崩溃两次... 都是在后台没开窗口的情况下, 自己崩的(每次打开自动刷新都会打开, 经常忘记关, 不太清楚是否有效) 没用过WPF, 但以个人从其他UI框架的理解来看, 在后台, 窗口没打开的情况下, UI元素应该都不存在才对, 为啥会进行对TextBoxView的对齐操作

我这里有同样的崩溃现象,平时与μtorrent一起挂在后台使用。观察到软件的静默启动方式是先打开窗口再关闭,是否意味着在后台也会刷新ui元素?
另外,我写了一个脚本,每30秒检测v2rayN是否正常运行并自动重启v2rayN,这是其工作日志:
start v2rayN at 2024/06/29 周六 23:46:35.49
restart crashed v2rayN at 2024/06/30 周日 8:30:35.22
restart crashed v2rayN at 2024/06/30 周日 10:07:05.30
restart crashed v2rayN at 2024/06/30 周日 10:30:05.28
start v2rayN at 2024/07/01 周一 14:24:44.47
restart crashed v2rayN at 2024/07/02 周二 0:50:14.33
start v2rayN at 2024/07/02 周二 12:05:28.07
start v2rayN at 2024/07/02 周二 22:17:38.13
start v2rayN at 2024/07/03 周三 0:00:45.39
start v2rayN at 2024/07/03 周三 20:06:38.46
restart crashed v2rayN at 2024/07/03 周三 20:07:08.18
start v2rayN at 2024/07/03 周三 20:13:19.10
start v2rayN at 2024/07/03 周三 23:19:04.35
restart crashed v2rayN at 2024/07/04 周四 10:24:16.27
restart crashed v2rayN at 2024/07/04 周四 10:38:16.25
崩溃时间分布也许有助于帮助排查问题

@TPtreehole
Copy link

事件查看器中看到的同样都是.net先崩溃,然后应用程序崩溃,.net崩溃信息如下:
Application: v2rayN.exe
CoreCLR Version: 8.0.624.26715
.NET Version: 8.0.6
Description: The application requested process termination through System.Environment.FailFast.
Message: 不可恢复的系统错误。
Stack:
at System.Environment.FailFast(System.String)
at System.Windows.Controls.TextBoxView.ArrangeVisuals(System.Windows.Size)
at System.Windows.Controls.TextBoxView.ArrangeOverride(System.Windows.Size)
at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect)
at System.Windows.UIElement.Arrange(System.Windows.Rect)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(System.Object)
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object)
at System.Windows.Media.MediaContext.RenderMessageHandler(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at v2rayN.App.Main()
应用程序崩溃信息(部分)如下:
错误应用程序名称: v2rayN.exe,版本: 6.45.0.0,时间戳: 0x661f0000
错误模块名称: unknown,版本: 0.0.0.0,时间戳: 0x00000000
异常代码: 0x80131623
错误偏移量: 0x00007ffe8098aff6

@2dust 2dust reopened this Jul 8, 2024
@2dust
Copy link
Owner

2dust commented Jul 8, 2024

问题应该在刷新信息太多太快了。
尝试修复,希望大家来配合测试下

@2dust
Copy link
Owner

2dust commented Jul 8, 2024

v2rayN_x64_net8_test.zip

试一下这个版本

@JoeZhangYN
Copy link

v2rayN_x64_net8_test.zip

试一下这个版本

问题描述

换了新的版本,同样的.net 环境崩溃。
系统日志和上面的完全一样。
程序的错误代码为 0x80131623。

参考内容

CSDN:
此错误可能是 CLR 中的 bug,或者是用户代码的不安全部分或不可验证部分中的 bug。
此 bug 的常见来源包括用户对 COM-interop 或 PInvoke 的封送处理错误,这些错误可能会损坏堆栈。”

GPT-4o:
错误代码 0x80131623 是 .NET Framework 中的一般性异常代码。这通常表示应用程序中的未处理异常或问题。
可能的原因
未处理的异常:应用程序代码中没有捕获的异常。
配置文件错误:应用程序的配置文件(如 app.config 或 web.config)存在问题。
数据库连接问题:连接数据库时发生错误。
文件访问问题:访问文件时出现权限问题或文件不存在。
内存泄漏:应用程序中的内存管理问题。

易于复现的环境

该软件和雪藏HsFreezer一起使用时(只要开启雪藏HsFreezer),
https://github.com/superDMS/HsFreezer-Hidden-in-the-snow-
崩溃概率瞬间变高。
问题很容易复现,旧版本的话(为此重装了2台电脑)。

实测

新版本在虚拟机内测试,基本没多少收发,时间一长,但依旧崩溃。
现已快照还原系统,待后续继续测试

@2dust
Copy link
Owner

2dust commented Jul 11, 2024

无法复现,估计难了
dotnet/wpf#8507

@Aobanana-chan
Copy link
Author

Aobanana-chan commented Jul 13, 2024

v2rayN_x64_net8_test.zip

试一下这个版本

还是崩了,这个版本并没有解决。
这次的堆栈

Application: v2rayN.exe
CoreCLR Version: 8.0.23.53103
.NET Version: 8.0.0
Description: The application requested process termination through System.Environment.FailFast.
Message: 不可恢复的系统错误。
Stack:
at System.Environment.FailFast(System.String)
at System.Windows.Controls.TextBoxView.ArrangeVisuals(System.Windows.Size)
at System.Windows.Controls.TextBoxView.ArrangeOverride(System.Windows.Size)
at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect)
at System.Windows.UIElement.Arrange(System.Windows.Rect)
at System.Windows.ContextLayoutManager.UpdateLayout()
at v2rayN.Views.MsgView.AppendText(System.String)
at DynamicClass.InvokeStub_Action1.Invoke(System.Object, System.Span1<System.Object>)
at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
at System.Delegate.DynamicInvokeImpl(System.Object[])
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at v2rayN.App.Main()

emm,观察了一下堆栈, 我这边所有的异常都是在v2rayN.Views.MsgView.AppendText(System.String)
TPtreeholeJoeZhangYN的tb区别还是挺大的, 或许是l两个问题,应该分开看
或许记录下AppendText的输入可能会有帮助?
CodeReview了一下AppendText,感觉确实没太大问题,怀疑是因为null值导致的,用null值试了下,会在ShowMsg抛出异常,和崩溃的tb不相符,那猜测和ClearMsg()以及txtMsg.ScrollToEnd()有关的可能性是最大的。
难道是wpf对TextBox操作线程不安全,在消息多的时候,这两个函数并行会崩溃吗? 查了点资料,Dispatcher在 UI 线程调度,按照调度优先级的顺序执行,应该也不太可能..

同时,更新了一波VS,把.net 升到了8.0.7, Commit: 2aade6beb0,观察下是否有用

@TPtreehole
Copy link

.net8.0.7下出现崩溃,发生时与utorrent、clash verge一起挂在后台使用。事件查看器中看到的同样都是.net先崩溃,然后应用程序崩溃,.net崩溃信息如下:
Application: v2rayN.exe
CoreCLR Version: 8.0.724.31311
.NET Version: 8.0.7
Description: The application requested process termination through System.Environment.FailFast.
Message: 不可恢复的系统错误。
Stack:
at System.Environment.FailFast(System.String)
at System.Windows.Controls.TextBoxView.ArrangeVisuals(System.Windows.Size)
at System.Windows.Controls.TextBoxView.ArrangeOverride(System.Windows.Size)
at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect)
at System.Windows.UIElement.Arrange(System.Windows.Rect)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(System.Object)
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object)
at System.Windows.Media.MediaContext.RenderMessageHandler(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at v2rayN.App.Main()
应用程序崩溃信息如下:
错误应用程序名称: v2rayN.exe,版本: 6.50.0.0,时间戳: 0x66470000
错误模块名称: unknown,版本: 0.0.0.0,时间戳: 0x00000000
异常代码: 0x80131623
错误偏移量: 0x00007ffe96e2f0ed
错误进程 ID: 0x0x790

@EasonTong
Copy link

未发现触发崩溃的条件

.NET Version: 8.0.7

Application: v2rayN.exe CoreCLR Version: 8.0.724.31311 .NET Version: 8.0.7 Description: The application requested process termination through System.Environment.FailFast. Message: 不可恢复的系统错误。 Stack: at System.Environment.FailFast(System.String) at System.Windows.Controls.TextBoxView.ArrangeVisuals(System.Windows.Size) at System.Windows.Controls.TextBoxView.ArrangeOverride(System.Windows.Size) at System.Windows.FrameworkElement.ArrangeCore(System.Windows.Rect) at System.Windows.UIElement.Arrange(System.Windows.Rect) at System.Windows.ContextLayoutManager.UpdateLayout() at System.Windows.ContextLayoutManager.UpdateLayoutCallback(System.Object) at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() at System.Windows.Media.MediaContext.RenderMessageHandlerCore(System.Object) at System.Windows.Media.MediaContext.RenderMessageHandler(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at v2rayN.App.Main()
第一次报错弹窗
image
第二次报错弹窗
image

@Aobanana-chan
Copy link
Author

去瞅了WPF的源码。
可以确定的是, 程序应该是在ArrangeVisuals中的
Invariant.Assert(CheckFlags(Flags.ArrangePendingFromHighlightLayer) || _dirtyList == null);
断言失败导致的崩溃。(此时的ArrangePendingFromHighlightLayer为false, _dirtyList != null)

(以下开始瞎猜)

ArrangePendingFromHighlightLayer只有在HandleTextSelectionHighlightChange中才设为true, 这个函数和选中的高亮有关。

         // If _dirtyList is non-null here, it means we
         // have pending highlight changes to sync to.
         // These changes never affect line metrics, but
         // they will clear out any cached Visuals affected.
         if (_dirtyList != null)
         {
             InvalidateDirtyVisuals();
             _dirtyList = null;
         }

_dirtyList 也和选中的高亮有关。但在OnTextContainerChange有嫌疑比较大的用法。

        // Callback from the TextContainer on a document edit.
        private void OnTextContainerChange(object sender, TextContainerChangeEventArgs args)
        {
            if (args.Count == 0)
            {
                // A no-op for this control.  Happens when IMECharCount updates happen
                // without corresponding SymbolCount changes.
                return;
            }

            //
            // Add the change to our dirty list.
            //

            if (_dirtyList == null)
            {
                _dirtyList = new DtrList();
            }

            DirtyTextRange dirtyTextRange = new DirtyTextRange(args);
            _dirtyList.Merge(dirtyTextRange);

            //
            // Force a re-measure.
            //
            InvalidateMeasure();
        }

这里只要进去了,可能不论有无merge内容,都会造成_dirtyList 不是null,然后这时如果调用ArrangeVisuals,就可能会导致断言失败。

这很可能不是V2rayN的问题,而是WPF内部的错误。但苦于无复现方式。但我们的复现思路或许可以往这里靠。

@2dust
Copy link
Owner

2dust commented Jul 23, 2024

开过几个测试环境,都无法复现
看大家的描述情况,可能发生在有大量日志的时候信息框控件崩溃了

@TPtreehole
Copy link

发现当连不上服务器时尝试更新core,更新进度一直卡住就会触发崩溃,成功复现了一次,但后来服务器连上了就无法复现了()
崩溃信息与我之前发的一致,不再重复

@2dust
Copy link
Owner

2dust commented Sep 4, 2024

https://github.com/2dust/v2rayN/releases/tag/6.57

已经重构了日志信息显示界面,可以试一试,反馈下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants