Bug 510452 - Console stucks in some cases
Summary: Console stucks in some cases
Status: RESOLVED FIXED
Alias: None
Product: rkward
Classification: Applications
Component: R Console (other bugs)
Version First Reported In: unspecified
Platform: Ubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: RKWard Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-10 12:00 UTC by Jan
Modified: 2025-11-26 12:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan 2025-10-10 12:00:57 UTC
Using rkward-master-2157-linux-gcc-x86_64.AppImage at Lubuntu 24.04.3

SUMMARY
Start a script with many lines. Sometimes (really not often) the output on the R-console stucks anywhere but the script continues in the background.

STEPS TO REPRODUCE
Not reproducible.
Occurs randomly and sporadically.

OBSERVED RESULT
R-console stucks anywhere.

EXPECTED RESULT
The R-console displays commands and results until completion.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Lubuntu 24.04.3
Qt Version: 5.15.13

ADDITIONAL INFORMATION
No problems with previous version rkward-master-2013-linux-gcc-x86_64.AppImage.
Comment 1 Jan 2025-10-10 12:03:21 UTC
When the script is finished, the Stop button in the script window is inactive, but the Stop button in the R-console is still active.
Comment 2 Thomas Friedrichsmeier 2025-10-10 14:29:53 UTC
Thanks for reporting. 

Could you quantify "many lines", roughly?

"Start a script" means you have opened it in an editor window and select Run->Run All? Or are you pasting it (which does very similar, but not quite identical things in the background)?

Does your script produce any output (or possibly even a lot of output)?

Does your script contain (mostly) all code in a single syntactical unit (such as encapsulated in a local({...}) or function() {...}), or does it consist of more "interactive" small statements?
Comment 3 Thomas Friedrichsmeier 2025-10-10 16:02:01 UTC
Oh, and could you also put a rough percentage to "really not often"? So far my attempts to reproduce this have not been successful, and I'm not sure whether I just need more patience or some other ingredient.
Comment 4 Jan 2025-10-14 10:41:38 UTC
(In reply to Thomas Friedrichsmeier from comment #2)
> Thanks for reporting. 
> 
> Could you quantify "many lines", roughly?

So far, I've only observed this in scripts that have more than 100 lines. However, I hardly have any scripts that are shorter than that.

> "Start a script" means you have opened it in an editor window and select Run->Run All? Or are you pasting it (which does very similar, but not quite identical things in the background)?

First. The script is open in the editor window and I press Run All.

> Does your script produce any output (or possibly even a lot of output)?

The script that I noticed uses print(end-index) to write a kind of countdown. The countdown stopped halfway through, but I saw that there was still CPU load and after a while the result file was saved.

> Does your script contain (mostly) all code in a single syntactical unit (such as encapsulated in a local({...}) or function() {...}), or does it consist of more "interactive" small statements?

Nested for loops in which many functions are called.

(In reply to Thomas Friedrichsmeier from comment #3)
> Oh, and could you also put a rough percentage to "really not often"?

In a maximum of 5% of all designs.
Comment 5 Jan 2025-10-14 10:44:05 UTC
Correction of last comment: In a maximum of 5% of all attempts.
Comment 6 Thomas Friedrichsmeier 2025-10-14 16:54:26 UTC
Thanks for the additional info. I keep trying to replicate.

So, if I understand you correctly, the console does not get stuck while parsing some new lines, but rather somewhere inside a loop?

That countdown you mention might perhaps be assumed to print at a rate of one number per second, or would that be much more? (I wonder whether part of the problem is keeping up with the amount of output).
Comment 7 Jan 2025-10-15 11:04:05 UTC
(In reply to Thomas Friedrichsmeier from comment #6)
> Thanks for the additional info. I keep trying to replicate.
> 
> So, if I understand you correctly, the console does not get stuck while parsing some new lines, but rather somewhere inside a loop?

I can't say for certain whether it only occurs within loops, but it seems more likely there.

> That countdown you mention might perhaps be assumed to print at a rate of one number per second, or would that be much more? (I wonder whether part of the problem is keeping up with the amount of output).

The countdown is actually rather slow, usually one output per second (or slower).
The amount of output is rather small. The problem sometimes occurs after just a few lines.
Comment 8 Thomas Friedrichsmeier 2025-10-15 15:36:06 UTC
Many thanks, again. I still fail to see a smoking gun, or to reproduce the issue, locally.

The next time this happens to you, could you check a couple of items for me, after the bug has triggered?

1) Does the "Command log" continue to run?
2) Does the R Console react to anything? E.g. does right-click bring up a context menu?
3) What if you just try to run the next bit of code (after the command has actually finished)? Does the R Console reset itself? Does the code get run (try something with an easily visible result, such as "RK()")?
4) Can you continue to do other things involving R? E.g. double-click on some item in the "Workspace" tool window to bring up a summary.
5) Could you attach the log files (/tmp/rkward.frontend, /tmp/rkward.rbackend) of a session that showed the failure?
Comment 9 Jan 2025-11-26 12:37:57 UTC
I am currently using rkward-master-2221-linux-gcc-x86_64.AppImage. The problem has not occurred again with this version.
Who knows? Bug closed.