Jeffser / Alpaca

An Ollama client made with GTK4 and Adwaita
GNU General Public License v3.0
116 stars 18 forks source link

Alpaca flatpak keeps running in the background #75

Closed F-i-f closed 1 month ago

F-i-f commented 1 month ago

Describe the bug After an Alpaca session ran from the Flatpak has been closed, the ollama server keeps running.

Expected behavior I expect the ollama server to shut down after (some amount of) inactivity.

Screenshots Ran this after my Alpaca session was terminated for 20 minutes:

$ flatpak ps | grep Alpaca
4237587875  507754  com.jeffser.Alpaca  org.gnome.Platform
$ flatpak enter com.jeffser.Alpaca ps xf 
    PID TTY      STAT   TIME COMMAND
     52 ?        R+     0:00 ps xf
      1 ?        S      0:00 /usr/bin/bwrap --args 49 -- alpaca
     23 ?        Sl     0:06 /app/bin/ollama serve

Additional context Seen on Alpaca 0.9.2 Flatpak, commit 57e5ba2329d5.

Jeffser commented 1 month ago

Hi, maybe you have the run in background option turned on, you can switch that on the preferences menu

F-i-f commented 1 month ago

Run in background is disabled, which is the default I think: image

Jeffser commented 1 month ago

Could you first make sure the app is completely closed then run it using flatpak run com.jeffser.Alpaca then close it with the switch thing off and send me the output? Thanks

F-i-f commented 1 month ago

Sure...


% flatpak kill com.jeffser.Alpaca 
% flatpak ps
% flatpak run com.jeffser.Alpaca 
Starting Alpaca's Ollama instance...
Started Alpaca's Ollama instance
[GIN] 2024/05/30 - 15:16:24 | 200 |      34.374µs |       127.0.0.1 | GET      "/"
[GIN] 2024/05/30 - 15:16:24 | 200 |     339.332µs |       127.0.0.1 | GET      "/api/tags"

(alpaca:2): Gtk-CRITICAL **: 15:16:25.138: Unable to connect to the accessibility bus at 'unix:path=/run/flatpak/at-spi-bus': Unexpected lack of content trying to read a line
[GIN] 2024/05/30 - 15:16:35 | 200 |      80.269µs |       127.0.0.1 | GET      "/"
[GIN] 2024/05/30 - 15:16:35 | 200 |     515.556µs |       127.0.0.1 | GET      "/api/tags"
[GIN] 2024/05/30 - 15:16:38 | 200 |       52.12µs |       127.0.0.1 | GET      "/"
[GIN] 2024/05/30 - 15:16:38 | 200 |     504.568µs |       127.0.0.1 | GET      "/api/tags"
Closing app...
Stopped Alpaca's Ollama instance
% flatpak ps                     
Instance   PID    Application        Runtime
2170839431 903614 com.jeffser.Alpaca org.gnome.Platform
Jeffser commented 1 month ago

Fixed, thanks for the report!

Screencast from 2024-05-30 19-14-18.webm

F-i-f commented 4 weeks ago

Confirmed fixed in 0.9.3 from flathub. Thanks for the quick fix & release.

henriquead7 commented 2 weeks ago

The same error is happening on my machine, even closing the app the ollama server is still in the background consuming Vram.

System: Fedora Workstation 40 Flatpak version: 1.15.8 Alpaca version: 0.9.5 GPU: Nvidia GTX 1060 Nvidia driver: 550.90.07 CUDA: 12.4

https://github.com/Jeffser/Alpaca/assets/56042159/de1411dd-a088-444e-b1e2-2b56a5d267fa

(And congratulations for your work, Alpaca is a great app).