Bug 469926 - RKWard doesn't start anymore
Summary: RKWard doesn't start anymore
Status: RESOLVED FIXED
Alias: None
Product: rkward
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR critical
Target Milestone: ---
Assignee: RKWard Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-18 05:00 UTC by Nuno Gomes
Modified: 2023-07-18 12:16 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
strace output for rkward crash (3.31 MB, text/plain)
2023-07-14 19:30 UTC, Eric
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nuno Gomes 2023-05-18 05:00:58 UTC
SUMMARY
I was able to start the program after installing it. I took the opportunity to configure it according to my needs. However, when I tried to restart it, it didn't work anymore.
When I try to run it from the terminal, I get the following error messages:

```shell
QCommandLineParser: already having an option named "h"
QCommandLineParser: already having an option named "help-all"
QCommandLineParser: already having an option named "v"
zsh: segmentation fault (core dumped)  rkward
```
The program doesn't start even if I delete the .rkward configuration folder and

STEPS TO REPRODUCE
1. Install RKWard
2. Configure RKWard on first start
3. Relaunch the program

OBSERVED RESULT
RKWard won't start even if I delete the `.rkward/` configuration folder and reinstall the program.

EXPECTED RESULT
RKWard starts with the new configuration.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: RebornOS Linux x86_64 / KDE Plasma 5.27.5
(available in About System)
KDE Plasma Version: KDE Plasma 5.27.5
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9

ADDITIONAL INFORMATION
RKWard version: 0.7.5
R version: 4.3.0
RKward and R were installed via pacman; KDE was installed along with the RebornOS distribution.

I ran into the problem after configuring RKWard using the settings menu and restarting the program.
I reinstalled RKWard and deleted the .rkward configuration folder, but the problem persists.
Comment 1 Thomas Friedrichsmeier 2023-05-18 08:35:33 UTC
Please be a bit more specific. What exactly does "does not start anymore" mean? Is it the R backend that fails to start? What error messages do you see? Does it crash / hang?

Note that the main configuration file should be found at ~/.config/rkwardrc . You could try deleting that.
Comment 2 Nuno Gomes 2023-05-18 11:17:41 UTC
(In reply to Thomas Friedrichsmeier from comment #1)
> Please be a bit more specific. What exactly does "does not start anymore"
> mean? Is it the R backend that fails to start? What error messages do you
> see? Does it crash / hang?
> 
> Note that the main configuration file should be found at ~/.config/rkwardrc
> . You could try deleting that.

Thank you for your response and consideration of my bug report.
I think I already answered your questions, but maybe I didn't fill out the report in the right order.
When I click the RKWard button, nothing happens; when I try to run it from the terminal, I get the following messages

QCommandLineParser: already having an option named "h"
QCommandLineParser: already having an option named "help-all"
QCommandLineParser: already having an option named "v"
zsh: segmentation fault (core dumped)  rkward

Your tip on where to find the configuration file was very helpful. I deleted it and was able to restart RKWard.
I was also able to pinpoint the origin of the problem to the configuration of Kate's plugins. I haven't done a thorough search to find out which plugin is causing the problem reported above, but if I don't change the default configuration, everything works fine.
Comment 3 Eric 2023-07-14 19:30:13 UTC
Created attachment 160290 [details]
strace output for rkward crash

This is the strace output for rkward when it crashes at start.
Comment 4 Eric 2023-07-14 19:33:45 UTC
(In reply to Eric from comment #3)
> Created attachment 160290 [details]
> strace output for rkward crash
> 
> This is the strace output for rkward when it crashes at start.

Not sure what happened to the rest of my comment, it disappeared after I added the attachment.

I'm on Fedora 38. I built version 0.7.5 from the tarball, and also tried building from git. In both cases it is crashing on startup with an error about the R backend:

Connection closed unexpectedly. Last error was: QLocalSocket: Remote closed
The R backend will be shut down immediately. This means, you can not use any more functions that rely on it.
Comment 5 Thomas Friedrichsmeier 2023-07-16 13:24:03 UTC
To be clear, this is a _new_ issue, this time, right (which also happens to pop up at start)?

Unfortunately the strace does not really tell anything, importantly, because the R backend is run in a separate process. Looking at /tmp/rkward.rbackend may be more helpful, possibly also after starting with rkward --debug-level 5

But first things first, this problem came up when? After upgrading R, perhaps? If so to what version?
Comment 6 Eric 2023-07-16 14:36:37 UTC
Thank you for the instructions. My system is stock Fedora 38 with R version 4.3.1. The version of rkward shipped with F38 is 0.7.4 and it works fine. Running rkward version 0.7.5 with --debug-level 5 shows an error in the output of /tmp/rkward.rbackend:

...
... lots of stuff here that seems fine
...
Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrbackendprotocol_shared.cpp - function ~RBackendRequest line 42
Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrsupport.cpp - function environmentFor line 289 creating new shadow environment for 0x9f94d8

Assert 'Rf_isEnvironment(shadowenvbase)' failed at /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrsupport.cpp - function environmentFor line 301
Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrbackend.cpp - function RWriteConsoleEx line 454
raw output type 1, size 51: Error: argument to 'findVar' is not an environment

Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrbackendprotocol_shared.cpp - function handleOutput line 166
Output type 2: Error: argument to 'findVar' is not an environment

Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrbackend.cpp - function doSimpleBackendCall line 968
Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrsupport.cpp - function SEXPToStringList line 82
Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrbackend.cpp - function doError line 906
Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrbackendprotocol_shared.cpp - function handleOutput line 166
Output type 3: Error: argument to 'findVar' is not an environment

error 'Error: argument to 'findVar' is not an environment

Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrbackend.cpp - function tryToDoEmergencySave line 603
Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrbackend.cpp - function RCleanUp line 536
Created emergency save file in /home/ehm/.rkward/rkward_recover0.RData
Cleanup finished
Main loop finished
Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkbackendtransmitter.cpp - function doExit line 75
Aborting connection to frontend
Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rktransmitter.cpp - function disconnected line 270
Trace: /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrbackend.cpp - function tryToDoEmergencySave line 603
Assert 'false' failed at /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rksignalsupport.cpp - function signal_proxy line 98
Comment 7 Thomas Friedrichsmeier 2023-07-16 19:49:16 UTC
Thanks.

Could you attach the full /tmp/rkward.rbackend from that run to this report? What you pasted clearly shows an error, but I'm not sure, it's the first thing going wrong.

(My guess is that actually the wrong - 0.7.4 - version of the RKWard R package is being loaded, although that condition is _supposed_ to be handled, automatically).
Comment 8 Eric 2023-07-16 20:05:15 UTC
The file is over 20MB so I can't send it. You were right though, there were errors in there about 0.7.5 not being the correct version it finds. So to simplify things I uninstalled 0.7.4 from the system and ran 0.7.5 again. Both the frontend and rbackend files are very small now, but there is still a crash of the R backend. Here is the output.

$ cat /tmp/rkward.frontend 
resource.ver not found. Data path(s): /home/ehm/.local/share/rkward:/home/ehm/.local/share/flatpak/exports/share/rkward:/var/lib/flatpak/exports/share/rkward:/usr/local/share/rkward:/usr/share/rkward
Assert 'QFileInfo::exists(source)' failed at /home/packages/SOURCE/rkward-0.7.5/rkward/rkward.cpp - function startR line 386
Assert 'QFile::copy(source, package)' failed at /home/packages/SOURCE/rkward-0.7.5/rkward/rkward.cpp - function startR line 388
Assert 'QFileInfo::exists(source)' failed at /home/packages/SOURCE/rkward-0.7.5/rkward/rkward.cpp - function startR line 386
Assert 'QFile::copy(source, package)' failed at /home/packages/SOURCE/rkward-0.7.5/rkward/rkward.cpp - function startR line 388
R syntax highlighting definition ('R interactive session')not found!
QMetaObject::invokeMethod: No such method KatePluginIntegrationWindow::createViewBar(KTextEditor::View*)
Command failed (other)
failed command was 0: 'R Startup'
- error message was: ''
XML-parsing 'pages//rkward_welcome.rkh' : Could not open file pages//rkward_welcome.rkh for reading
XML-parsing 'pages//rkward_welcome.rkh' : Error parsing XML-file. Error-message was: 'unexpected end of file' in line '1', column '1'. Expect further errors to be reported below
Wayland does not support QWindow::requestActivate()
Wayland does not support QWindow::requestActivate()
The Wayland connection experienced a fatal error: Bad file descriptor


$ cat /tmp/rkward.rbackend 
Changing locale
New locale codec is UTF-8
Assert 'Rf_isEnvironment(shadowenvbase)' failed at /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rkrsupport.cpp - function environmentFor line 301
Created emergency save file in /home/ehm/.rkward/rkward_recover0.RData
Assert 'false' failed at /home/packages/SOURCE/rkward-0.7.5/rkward/rbackend/rksignalsupport.cpp - function signal_proxy line 98
Comment 9 Thomas Friedrichsmeier 2023-07-16 20:38:54 UTC
It still appears to be essentially the same issue, and more specifically, RKWard does not appear to find _any_ of its own files, including its R package.

So, this is quite clearly an installation problem (although it should definitely be handled more gracefully, that is truly a regression I will need to look into). Could you summarize the steps you took to compile / install? And from what path are you starting rkward?
Comment 10 Eric 2023-07-16 20:42:55 UTC
Here is my procedure:

tar xvf rkward-0.7.5.tar.gz
cd rkward-0.7.5
mkdir ehm_build ehm_install
cd ehm_build
cmake .. -DR_EXECUTABLE=`which R` -DCMAKE_INSTALL_PREFIX=/home/packages/SOURCE/rkward-0.7.5/ehm_install/ 
make -j8
make install
Comment 11 Eric 2023-07-16 20:44:59 UTC
I forgot, I start rkward by giving the full path:
/home/packages/SOURCE/rkward-0.7.5/ehm_install/bin/rkward
Comment 12 Thomas Friedrichsmeier 2023-07-16 20:57:28 UTC
> /home/ehm/.local/share/rkward:/home/ehm/.local/share/flatpak/exports/share/rkward:/var/lib/flatpak/exports/share/rkward:/usr/local/share/rkward:/usr/share/rkward

Ok, so the installation path is not among the paths that get searched. I guess, I can see what's happening, here, the assumption still appears to be that the installation directory is one of $XDG_DATA_DIRS. Will need to investigate a fix.

We do have some special lookup mechanisms for running directly from the build tree. Try:
  /home/packages/SOURCE/rkward-0.7.5/ehm_build/rkward/rkward
Comment 13 Eric 2023-07-16 21:12:39 UTC
That works, rkward starts up without error. Thank you!
Comment 14 Thomas Friedrichsmeier 2023-07-17 15:42:22 UTC
Git commit 201b2cba2ab3620b297edf3a4b5a05524077ffc9 by Thomas Friedrichsmeier.
Committed on 17/07/2023 at 15:42.
Pushed by tfry into branch 'master'.

Improve support for running from non-standard paths on Linux

M  +2    -0    ChangeLog
M  +4    -1    rkward/CMakeLists.txt
M  +10   -2    rkward/main.cpp

https://invent.kde.org/education/rkward/-/commit/201b2cba2ab3620b297edf3a4b5a05524077ffc9
Comment 15 Thomas Friedrichsmeier 2023-07-17 15:44:39 UTC
You mentioned building from git, previously. Could you test current git master with your regular build procedure, installing below your home directory, and running from there (i.e. the way that was broken, before)? In theory, this should work, now, too.
Comment 16 Eric 2023-07-17 16:29:27 UTC
Yes, I can confirm this works fine now. I followed the same build procedure in my comment above.
Comment 17 Eric 2023-07-17 16:30:37 UTC
(In reply to Eric from comment #16)
> Yes, I can confirm this works fine now. I followed the same build procedure
> in my comment above.

Except, from git master, of course.