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

File named file::memory:?cache=shared is created in the home directory on GUI launch #857

Closed
staticssleever668 opened this issue Feb 21, 2023 · 7 comments

Comments

@staticssleever668
Copy link
Contributor

Describe the bug

A file named file::memory:?cache=shared is created in the home directory when the GUI is launched.

  • OpenSnitch version: da4d834 (1.6.0rc4/1.6.0rc5)
  • OS: ArchLinux
  • Version: Rolling
  • Window Manager: Awesome
  • Kernel version: Linux qwerty 6.1.12-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 14 Feb 2023 22:08:08 +0000 x86_64 GNU/Linux

To Reproduce

  1. Make sure OpenSnitch GUI is not running
  2. Check existence of ~/file::memory:?cache=shared, if it exists - delete it
  3. Launch the GUI back
  4. See that the file has been created

Post error logs:
-

Expected behavior (optional)
If I understand correctly, this is supposed to create the file in-memory or in a temporary directory (#844).

Screenshots
-

Additional context
Looks like a regression introduced in 5b5e271.

@gustavo-iniguez-goya
Copy link
Collaborator

I don't have that file on my home, and the URI is specified here: https://www.sqlite.org/inmemorydb.html

Can you post the items of the entry [database] of your ~/.config/opensnitch/settings.conf ?

@gustavo-iniguez-goya
Copy link
Collaborator

I do have that file on Manjaro though.. hmm, I'll investigate it.

@gustavo-iniguez-goya
Copy link
Collaborator

removing file: from the URI doesn't create the file on disk. I'll validate if it keeps the behaviour that I tried to solve.

@staticssleever668
Copy link
Contributor Author

Can you post the items of the entry [database] of your ~/.config/opensnitch/settings.conf ?

[database]
file=:memory:
max_days=1
purge_interval=5
purge_oldest=false
type=0

Seems like the value of the file key was from an older version, so I tried removing the whole section, but the file still appears in the home directory. This is how the section started looking after a restart of opensnitch-ui:

[database]
file="file::memory:?cache=shared"
type=0

@gustavo-iniguez-goya
Copy link
Collaborator

According to the documentation, using a in-memory db with a shared cache, always writes a file to disk:

in order for the special ":memory:" name to apply and to create a pure in-memory database, there must be no additional text in the filename
and
In-memory databases are allowed to use [shared cache](https://www.sqlite.org/sharedcache.html) if they are opened using a [URI filename](https://www.sqlite.org/uri.html).

The only db name that it doesn't write a file to disk is :memory. I haven't found a way of placing this temporary file in another location.

So I'll think another way of doing this.

@gustavo-iniguez-goya
Copy link
Collaborator

Note: this behaviour does not occur on ubuntu 20.04 (libsqlite 3.31.1-4, libqt5sql5 5.12.18, libqt5sql5-sqlite 5.12.18)

@gustavo-iniguez-goya
Copy link
Collaborator

I've reverted this change, because it was behaving as if you were using a DB from disk.

So if users want to delete old events, now they'll have to save events to disk.

gustavo-iniguez-goya added a commit that referenced this issue Nov 3, 2023
Not deleting events from in-memory db can lead to a high mem usage under
certain scenarios.

Previous attempt to solve this issue wrote events to disk in a temporal
file (when using file::memory:?cache=shared).

Related issues: #844 #857

Closes: #1030
gustavo-iniguez-goya added a commit that referenced this issue Nov 6, 2023
Not deleting events from in-memory db can lead to a high mem usage under
certain scenarios.

Previous attempt to solve this issue wrote events to disk in a temporal
file (when using file::memory:?cache=shared).

Related issues: #844 #857

Closes: #1030
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants