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]: Unhandled exception. SQLiteException: attempt to write a readonly database #6250

Open
2 tasks done
dev-deeper opened this issue Dec 7, 2024 · 1 comment
Open
2 tasks done
Labels
bug Something isn't working

Comments

@dev-deeper
Copy link

预期情况

The app saves VLESS server config

实际情况

The app was terminated abnormally due to an unhandled exception "SQLite.SQLiteException: attempt to write a readonly database"

复现方法

  1. Run the app: /opt/v2rayN-linux-64/./v2rayN
  2. Add new server: Servers -> Add [VLESS] server
  3. Fill required fields: Alias/Address/Port/UUID
  4. Click Confirm

日志信息

~ /opt/v2rayN-linux-64/./v2rayN
Unhandled exception. ReactiveUI.UnhandledErrorException: An object implementing IHandleObservableErrors (often a ReactiveCommand or ObservableAsPropertyHelper) has errored, thereby breaking its observable pipeline. To prevent this, ensure the pipeline does not error, or Subscribe to the ThrownExceptions property of the object in question to handle the erroneous case.
---> SQLite.SQLiteException: attempt to write a readonly database
at SQLite.PreparedSqlLiteInsertCommand.ExecuteNonQuery(Object[] source)
at SQLite.SQLiteConnection.Insert(Object obj, String extra, Type objType)
at SQLite.SQLiteConnection.InsertOrReplace(Object obj)
at SQLite.SQLiteAsyncConnection.<>c__DisplayClass54_0.b__0(SQLiteConnectionWithLock conn)
at SQLite.SQLiteAsyncConnection.<>c__DisplayClass33_01.<WriteAsync>b__0() at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at ServiceLib.Common.SQLiteHelper.ReplaceAsync(Object model)
at ServiceLib.Handler.ConfigHandler.AddServerCommon(Config config, ProfileItem profileItem, Boolean toFile)
at ServiceLib.Handler.ConfigHandler.AddVlessServer(Config config, ProfileItem profileItem, Boolean toFile)
at ServiceLib.Handler.ConfigHandler.AddServer(Config config, ProfileItem profileItem)
at ServiceLib.ViewModels.AddServerViewModel.SaveServerAsync()
at ServiceLib.ViewModels.AddServerViewModel.<.ctor>b__11_0()
--- End of inner exception stack trace ---
at ReactiveUI.RxApp.<>c__DisplayClass9_0.<.cctor>b__2() in c:\temp\releaser\ReactiveUI\src\ReactiveUI\RxApp.cs:line 105
at System.Reactive.Concurrency.Scheduler.Invoke(Action action)
at System.Reactive.Concurrency.Scheduler.<>c.b__74_0(IScheduler _, Action a)
at Avalonia.ReactiveUI.AvaloniaScheduler.Schedule[TState](TState state, TimeSpan dueTime, Func3 action) at System.Reactive.Concurrency.LocalScheduler.Schedule[TState](TState state, Func3 action)
at System.Reactive.Concurrency.Scheduler.Schedule(IScheduler scheduler, Action action)
at ReactiveUI.RxApp.<>c.<.cctor>b__9_1(Exception ex) in c:\temp\releaser\ReactiveUI\src\ReactiveUI\RxApp.cs:line 105
at System.Reactive.AnonymousSafeObserver1.OnNext(T value) at System.Reactive.ObserveOnObserverNew1.DrainStep(ConcurrentQueue1 q) at System.Reactive.ObserveOnObserverNew1.DrainShortRunning(IScheduler recursiveScheduler)
at System.Reactive.ObserveOnObserverNew1.<>c.<.cctor>b__17_0(IScheduler scheduler, ObserveOnObserverNew1 self)
at Avalonia.ReactiveUI.AvaloniaScheduler.<>c__DisplayClass4_11.<Schedule>b__1() at Avalonia.Threading.DispatcherOperation.InvokeCore() at Avalonia.Threading.DispatcherOperation.Execute() at Avalonia.Threading.Dispatcher.ExecuteJob(DispatcherOperation job) at Avalonia.Threading.Dispatcher.ExecuteJobsCore(Boolean fromExplicitBackgroundProcessingCallback) at Avalonia.Threading.Dispatcher.Signaled() at Avalonia.X11.X11PlatformThreading.CheckSignaled() at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken) at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl) at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.StartCore(String[] args) at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, Action1 lifetimeBuilder)
at v2rayN.Desktop.Program.Main(String[] args)
[1] 3632 IOT instruction (core dumped) /opt/v2rayN-linux-64/./v2rayN

额外信息

The app: v2rayN v7.2.3
Platform: Fedora Linux 41
DE: xfce 4.18

Disabling SELinux doesn't resolve issue

我确认已更新至最新版本

我确认已查询历史issues

@dev-deeper dev-deeper added the bug Something isn't working label Dec 7, 2024
@dev-deeper
Copy link
Author

dev-deeper commented Dec 8, 2024

I found workaround for this issue. The core of the problem:

  1. the app was unzipped to /opt/v2rayN-linux-64 directory with root user permissions.
  2. starting up the app under user privileges causes gui configs to be written to a directory next to binary file.
  3. the app crashed due to an unhandled exception SQLite.SQLiteException: attempt to write a readonly database while saving a server data.

I haven't had similar issues with other applications installed in /opt directory before. The reason is that other apps always save user config data under home directory while a binary remains at the place. I suggest doing the same: save gui configurations in home directory separately for each user (not in the same directory as the binary file).

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

1 participant