matthiasn / lotti

Achieve your goals and keep your data private with Lotti. This life tracking app is designed to help you stay motivated and on track, all while keeping your personal information safe and secure. Now with on-device speech recognition.
GNU General Public License v3.0
501 stars 52 forks source link

Startup issue on Linux: no GUI window showing up #27

Closed rayx closed 5 years ago

rayx commented 5 years ago

Hi, I followed the procedure in README to build the code from source, everything seemed to work fine (there might be few warning messages but I didn't pay much attention to them). Then I started meins, it output the following message and stopped there, with no GUI interface showing up:

$ ./target/jlink/bin/meins
22:02:27.413 [async-dispatch-5    ] INFO   o.eclipse.jetty.util.log - Logging initialized @6955ms to org.eclipse.jetty.util.log.Slf4jLog
22:02:27.625 [async-dispatch-5    ] INFO                   org.xnio - XNIO version 3.3.6.Final
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.xnio.nio.NioXnio$2 (file:/localdata/github/meins/target/jlink/meins.jar) to constructor sun.nio.ch.EPollSelectorProvider()
WARNING: Please consider reporting this to the maintainers of org.xnio.nio.NioXnio$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
22:02:27.702 [async-dispatch-5    ] INFO     o.p.wunderboss.web.Web - Registered web context /
22:02:27.709 [async-dispatch-5    ] INFO                 m.s.server - Immutant-web listening on port 8765 on interface localhost

I'm not sure what exactly those "illegal reflective access" warning messages meant or if they mattered. Accessing the web server running at localhost:8765 returns only a simple "hello world..." text.

Below are the process tree:

meins,83142 ./target/jlink/bin/meins
  `-java,83144 -jar ./target/jlink/bin/../meins.jar
      |-{java},83145
      |-{java},83146
      |-{java},83147
      |-{java},83148
      |-{java},83149
      |-{java},83150
      |-{java},83151
      |-{java},83152
      |-{java},83153
      |-{java},83154
      |-{java},83155
      |-{java},83156
      |-{java},83157
      |-{java},83158
      |-{java},83159
      |-{java},83160
      |-{java},83161
      |-{java},83171
      |-{java},83172
      |-{java},83173
      |-{java},83174
      |-{java},83175
      |-{java},83176
      |-{java},83177
      |-{java},83178
      |-{java},83179
      |-{java},83180
      |-{java},83181
      |-{java},83182
      |-{java},83183
      |-{java},83184
      `-{java},83185

Top or strace commands show that they are not doing anything interesting.

Any idea what went wrong? Thanks.

matthiasn commented 5 years ago

Hi @rayx, that is looking good so far. In addition to using lein run or starting the binary as you did, you need to run npm start from the project root. The packaged version that you can create with make release would start the Java process in the background for you. That command would fail for you without my GH_TOKEN in the environment, but it would still create the packaged version in ./dist. Please let me know if this helps.

rayx commented 5 years ago

Hi @rayx, that is looking good so far. In addition to using lein run or starting the binary as you did, you need to run npm start from the project root.

Thanks for your quick response. It works now (though I have yet to read meins doc to understand how to use it). If I understand it correctly, lein run starts a server, and npm start an electron based application, right? It would be good to have a brief introduction to the architecture in the README, as well as the two commands to start the application (Perhaps in install section or a separate section? They are currently in Development section, which I skipped because I was focusing on how to start the application first.)

The packaged version that you can create with make release would start the Java process in the background for you. That command would fail for you without my GH_TOKEN in the environment, but it would still create the packaged version in ./dist. Please let me know if this helps.

I ran make install. I didn't run make package. Should I run it?

matthiasn commented 5 years ago

@rayx true, I need to spend some time on describing the architecture. Yes, there is a server process and the electron based frontend, and they talk to each other via a WebSockets connection. I had put the commands in the development section as you typically only need them during development, whereas in normal day-to-day usage, you can either package yourself with make package, or simply download a packaged version from the release page.

rayx commented 5 years ago

@matthiasn I'm new to node.js, electron, and clojure. If I understand it correctly, the package in make package is a electron package, right? So I ran make package and the command completed successfully. Then I ran npm start meins and the GUI showed up. Is this the recommended way to run the application?

Just curious, do I understand it correctly that, conceptually, npm start meins effectively runs a script that does the following:

 lein run &
 npm start meins

BTW, I checked out the release page you provided, but it didn't have deb package, that's the reason why I ran make package myself. That said, the command didn't generate any deb package in meins source code directory after it finished. Am I missing something?

rayx commented 5 years ago

Now that I'm able to start the GUI main window, I run into two more issues.

Any suggestions? Thanks.

(Let me know if you'd like me to move the discussion in a new thread because they are different issues).

matthiasn commented 5 years ago

When running make package the electron packager outputs two formats, AppImage and Snap. These can be found in ./dist. You can also download either and see if they are supported by your Linux distribution from releases. On Ubuntu, I am running the AppImage binary. You might have to run chmod +x on them. The background process stays running indeed for faster startup, that's expected. If you want to close everything, there's a menu item Quit Background Services.

An empty window is definitely not expected after running lein run and npm start. Are you running shadow-cljs watch renderer which compiles the JavaScript for development purposes, including hot reload? It sounds like the JS is missing. make package only compiles the release version, so that won't help when starting with npm start.

I'm not sure where the npm start meins comes from, the lein run and npm start have to be started separately. Please let me know if this helps.

rayx commented 5 years ago

@matthiasn Thanks for your help. I'm able to get the AppImage binary and the development mode working, but snap package is still not working (I'll ignore it for now). More details below.

Note: the AppImage image and snap package I tried were built by me. I did downloaded AppImage from your release page, it worked too.

When running make package the electron packager outputs two formats, AppImage and Snap. These can be found in ./dist. You can also download either and see if they are supported by your Linux distribution from releases. On Ubuntu, I am running the AppImage binary. You might have to run chmod +x on them.

Yes, the AppImage binary works.

The snap package doesn't work in my system. Below is its log:

 $ meins
22:01:04:252 INFO [meins.electron.main.core:67] - Starting CORE: {:icon-path "/snap/meins/x1/resources/app/resources/icon.png",
 :daily-logs-path
 "/home/rayx/snap/meins/x1/.config/meins/data/daily-logs",
 :capabilities nil,
 :jar "/snap/meins/x1/resources/app/bin/jlink/meins.jar",
 :blink "/snap/meins/x1/resources/app/bin/blink1-mac-cli",
 :data-path "/home/rayx/snap/meins/x1/.config/meins/data",
 :img-path "/home/rayx/snap/meins/x1/.config/meins/data/images",
 :node-path "/usr/local/bin/node",
 :logfile-electron "/tmp/meins-electron.log",
 :download-path "/home/rayx/Downloads",
 :cwd "/var/lib/snapd/void",
 :index-page "resources/index.html",
 :port 7788,
 :electron-path "/snap/meins/x1/meins",
 :resources-path "/snap/meins/x1/resources",
 :repo-dir false,
 :user-data "/home/rayx/snap/meins/x1/.config/meins",
 :thumbs-path "/home/rayx/snap/meins/x1/.config/meins/data/thumbs",
 :java "/snap/meins/x1/resources/app/bin/jlink/bin/java",
 :cache "/home/rayx/snap/meins/x1/.config/meins/data/cache.dat",
 :logdir "/tmp/",
 :app-path "/snap/meins/x1/resources/app",
 :help-page "http://localhost:7788/help/manual.html",
 :pg-port 7787,
 :gql-port 7789,
 :pid-file "/home/rayx/snap/meins/x1/.config/meins/data/meins.pid",
 :index-page-pg "resources/index-pg.html",
 :logfile-jvm "/tmp/meins-jvm.log",
 :manual-path "/snap/meins/x1/resources/app/doc",
 :pg-pid-file
 "/home/rayx/snap/meins/x1/.config/meins/playground-data/meins.pid",
 :version "0.6.161",
 :audio-path "/home/rayx/snap/meins/x1/.config/meins/data/audio",
 :encrypted-path "/home/rayx/snap/meins/x1/.config/meins/encrypted",
 :platform "linux",
 :playground-path
 "/home/rayx/snap/meins/x1/.config/meins/playground-data"}

22:01:04:278 INFO [meins.electron.main.update:41] - Starting UPDATE Component
22:01:04:288 INFO [meins.electron.main.menu:326] - Starting Menu Component
22:01:04:335 INFO [meins.electron.main.menu:315] - Starting Menu
22:01:04:443 INFO [meins.electron.main.startup:72] - JVM up? nil {:environment :live}
22:01:04:464 INFO [meins.electron.main.update:55] - UPDATE: check release versions
22:01:04:465 Checking for update
22:01:04:516 INFO [meins.electron.main.update:23] - Checking for update...
22:01:04:572 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:01:04:576 Error: Error: ENOENT: no such file or directory, open '/snap/meins/x1/resources/app-update.yml'
    at c.d [as _captureStackTrace] (/snap/meins/x1/resources/app/prod/main-shadow/main.js:330:438)
    at new f (/snap/meins/x1/resources/app/prod/main-shadow/main.js:388:280)
    at /snap/meins/x1/resources/app/prod/main-shadow/main.js:394:349
    at u.doCheckForUpdates (/snap/meins/x1/resources/app/prod/main-shadow/main.js:936:282)
    at u.checkForUpdates (/snap/meins/x1/resources/app/prod/main-shadow/main.js:931:131)
    at /snap/meins/x1/resources/app/prod/main-shadow/main.js:9901:371
    at /snap/meins/x1/resources/app/prod/main-shadow/main.js:9706:236
    at Function.d [as cljs$core$IFn$_invoke$arity$1] (/snap/meins/x1/resources/app/prod/main-shadow/main.js:9686:400)
    at Object.cljs.core.async.impl.ioc_helpers.run_state_machine (/snap/meins/x1/resources/app/prod/main-shadow/main.js:9377:161)
    at Object.cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped (/snap/meins/x1/resources/app/prod/main-shadow/main.js:9378:116)
    at /snap/meins/x1/resources/app/prod/main-shadow/main.js:9379:239
    at /snap/meins/x1/resources/app/prod/main-shadow/main.js:9326:119
    at Immediate.cljs.core.async.impl.dispatch.process_messages (/snap/meins/x1/resources/app/prod/main-shadow/main.js:9311:298)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)
22:01:04:578 ERROR [meins.electron.main.update:39] - in auto-updater Error: ENOENT: no such file or directory, open '/snap/meins/x1/resources/app-update.yml'
22:01:04:611 INFO [matthiasn.systems-toolbox-electron.window-manager:25] - WM load-new file:///snap/meins/x1/resources/app/resources/loading.html {:width 400, :height 300, :show false, :webPreferences {:nodeIntegration true}, :icon nil}
Unhandled rejection Error: ENOENT: no such file or directory, open '/snap/meins/x1/resources/app-update.yml'
    at c.d [as _captureStackTrace] (/snap/meins/x1/resources/app/prod/main-shadow/main.js:330:438)
    at new f (/snap/meins/x1/resources/app/prod/main-shadow/main.js:388:280)
    at /snap/meins/x1/resources/app/prod/main-shadow/main.js:394:349
    at u.doCheckForUpdates (/snap/meins/x1/resources/app/prod/main-shadow/main.js:936:282)
    at u.checkForUpdates (/snap/meins/x1/resources/app/prod/main-shadow/main.js:931:131)
    at /snap/meins/x1/resources/app/prod/main-shadow/main.js:9901:371
    at /snap/meins/x1/resources/app/prod/main-shadow/main.js:9706:236
    at Function.d [as cljs$core$IFn$_invoke$arity$1] (/snap/meins/x1/resources/app/prod/main-shadow/main.js:9686:400)
    at Object.cljs.core.async.impl.ioc_helpers.run_state_machine (/snap/meins/x1/resources/app/prod/main-shadow/main.js:9377:161)
    at Object.cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped (/snap/meins/x1/resources/app/prod/main-shadow/main.js:9378:116)
    at /snap/meins/x1/resources/app/prod/main-shadow/main.js:9379:239
    at /snap/meins/x1/resources/app/prod/main-shadow/main.js:9326:119
    at Immediate.cljs.core.async.impl.dispatch.process_messages (/snap/meins/x1/resources/app/prod/main-shadow/main.js:9311:298)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)

22:01:04:658 INFO [meins.electron.main.startup:24] - STARTUP: spawning /snap/meins/x1/resources/app/bin/jlink/bin/java ["-Dapple.awt.UIElement=true" "-Xmx2g" "-jar" "/snap/meins/x1/resources/app/bin/jlink/meins.jar"] {:detached true, :cwd "/home/rayx/snap/meins/x1/.config/meins", :env {:PORT 7788, :GQL_PORT 7789, :LOG_FILE "/tmp/meins-jvm.log", :LOG_DIR "/tmp/", :APP_PATH "/snap/meins/x1/resources/app", :DATA_PATH "/home/rayx/snap/meins/x1/.config/meins/data"}}
22:01:04:669 INFO [meins.electron.main.startup:148] - JVM: startup :live
22:01:05:627 INFO [meins.electron.main.startup:72] - JVM up? 1 {:environment :live}
22:01:05:786 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:01:05:792 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html
22:01:06:799 INFO [meins.electron.main.startup:72] - JVM up? 2 {:environment :live}
22:01:07:785 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:01:07:790 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html
22:01:08:797 INFO [meins.electron.main.startup:72] - JVM up? 3 {:environment :live}
22:01:09:786 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:01:09:794 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html
22:01:10:801 INFO [meins.electron.main.startup:72] - JVM up? 4 {:environment :live}
22:01:11:785 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:01:11:792 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html
22:01:12:810 INFO [meins.electron.main.startup:72] - JVM up? 5 {:environment :live}
22:01:13:786 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:01:13:791 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html
22:01:14:799 INFO [meins.electron.main.startup:72] - JVM up? 6 {:environment :live}
22:01:19:590 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:01:19:606 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html
22:01:20:618 INFO [meins.electron.main.startup:72] - JVM up? 7 {:environment :live}
22:01:28:049 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:01:28:053 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html
22:01:29:063 INFO [meins.electron.main.startup:72] - JVM up? 8 {:environment :live}
22:01:29:624 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:01:29:633 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html
22:01:30:641 INFO [meins.electron.main.startup:72] - JVM up? 9 {:environment :live}
22:01:37:642 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:01:37:654 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html
22:01:38:662 INFO [meins.electron.main.startup:72] - JVM up? 10 {:environment :live}
22:02:04:257 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:02:04:261 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html
22:02:05:269 INFO [meins.electron.main.startup:72] - JVM up? 11 {:environment :live}
22:03:04:307 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:03:04:311 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html
22:03:05:322 INFO [meins.electron.main.startup:72] - JVM up? 12 {:environment :live}
22:03:14:503 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:03:14:522 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html
22:03:15:531 INFO [meins.electron.main.startup:72] - JVM up? 13 {:environment :live}
22:03:19:272 INFO [meins.electron.main.startup:84] - - Nope, trying again
22:03:19:277 INFO [matthiasn.systems-toolbox-electron.window-manager:17] - WM: window id exists, not creating new one: resources/loading.html

The log showed two issues:

The background process stays running indeed for faster startup, that's expected. If you want to close everything, there's a menu item Quit Background Services.

Yes it works indeed! That said, I still think there is another issue with the current behavior when I click Quit menu item. Since I start the AppImage binary in terminal, I notice that the command doesn't exit. If I kill the background process however, it exits immediately. Could it be that the electronic (the client side)'s connection with the background process somehow prevents the client process from exiting?

An empty window is definitely not expected after running lein run and npm start. Are you running shadow-cljs watch renderer which compiles the JavaScript for development purposes, including hot reload? It sounds like the JS is missing. make package only compiles the release version, so that won't help when starting with npm start.

Thanks for pointing out this. I reread the Development section of readme and got it working. BTW, I saw that shadow-cljs watch main and npm start processes output some error messages in console when I clicked menu items (though the application worked as expected). I'll ignore them for now.

I'm not sure where the npm start meins comes from, the lein run and npm start have to be started separately. Please let me know if this helps.

My mistake. I'm not familiar with npm. I thought npm start meins was same as npm start. My original question was that, since in development mode we start the client process and server process separately, I suppose the same has to be done in some way when running the application in AppImage binary or snap package. But I didn't find the message about backend service's port and hence the question.

matthiasn commented 5 years ago

Hi @rayx, I'm now only building the AppImage format and removed snap. AppImage works for me, and it sounds like that's working for you as well. Closing this for now, if anyone needs the snap format, please open a new ticket, and ideally help with making it work. Thanks!

rayx commented 5 years ago

No problem at all. I was trying the application mostly out of curiosity (I take text notes using emacs org-mode). I'm not familiar with the underlying stack of the application, but it seems interesting. Hopefully I'll take a closer look at it in future. Thanks.