Bug 433982 - Octave worksheet evaluation hangs on plot() function
Summary: Octave worksheet evaluation hangs on plot() function
Status: RESOLVED FIXED
Alias: None
Product: cantor
Classification: Applications
Component: octave-backend (show other bugs)
Version: 20.12.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Cantor Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-05 07:45 UTC by Egor Ignatov
Modified: 2021-03-10 20:15 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Cantor segfault backtrace (8.48 KB, text/plain)
2021-03-05 08:56 UTC, Egor Ignatov
Details
plot command run (61.62 KB, image/png)
2021-03-09 09:00 UTC, Nikita Sirgienko
Details
graphics_toolkits (51.63 KB, image/png)
2021-03-09 09:14 UTC, Egor Ignatov
Details
settings screenshot (65.41 KB, image/png)
2021-03-09 09:15 UTC, Egor Ignatov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Egor Ignatov 2021-03-05 07:45:50 UTC
SUMMARY
On the plot() function (and some other like: hist, bar, stem3, etc.) the evaluation hangs.

STEPS TO REPRODUCE
1. Open cantor with octave backend
2. Write 'plot(1:1)'
3. Click 'Evaluate Worksheet'

OBSERVED RESULT
The program is responsible, but nothing is plotted.
The green '>>>' prompt is blinking.
At the bottom says 'Calculating...'.

EXPECTED RESULT
The plot result appears.

SOFTWARE/OS VERSIONS
Linux: Ubuntu 20.10
KDE Frameworks Version: 5.74.0
Qt Version:     5.14.2
Cantor Version: 20.08.2
Octave Version: 5.2.0

Also reproduces under:
Linux: Alt Linux Workstation K 9.1
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.70.0
Qt Version:     5.12.9
Cantor Version: 20.12.3
Octave Version: 6.2.0


ADDITIONAL INFORMATION

Console output after "Evaluate Worksheet":

```
evaluate worksheet
login
starting  ("/usr/bin/octave-cli", "--silent", "--interactive", "--persist", "--eval", "PS1('CANTOR_OCTAVE_BACKEND_PROMPT:\\#> ');", "--eval", "PS2('CANTOR_OCTAVE_BACKEND_SUBPROMPT:\\#> ');", "--eval", "addpath \"/usr/share/cantor/octavebackend\";", "--eval", "suppress_verbose_help_message(1);")
wsStatusChange 1
login done
evaluating:  "if (length(available_graphics_toolkits()) > 0)\n    printf(\"%d\", 1);\nelse\n    printf(\"%d\", 0);\nendif"
wsStatusChange 0
currentExpressionStatusChanged 1 "if (length(available_graphics_toolkits()) > 0)\n    printf(\"%d\", 1);\nelse\n    printf(\"%d\", 0);\nendif"
readOutput
start parsing     "CANTOR_OCTAVE_BACKEND_PROMPT:1> "
readError
readOutput
start parsing     "1CANTOR_OCTAVE_BACKEND_PROMPT:2> "
readError
parseOutput:  "1"
setting result to a type  1  result
currentExpressionStatusChanged 2 "if (length(available_graphics_toolkits()) > 0)\n    printf(\"%d\", 1);\nelse\n    printf(\"%d\", 0);\nendif"
wsStatusChange 1
QString::arg: Argument missing: set (0, "defaultfigurevisible","off");, 
evaluating:  "set (0, \"defaultfigurevisible\",\"off\");"
wsStatusChange 0
currentExpressionStatusChanged 1 "set (0, \"defaultfigurevisible\",\"off\");"
evaluating:  "plot(1:1)"
readOutput
start parsing     "CANTOR_OCTAVE_BACKEND_PROMPT:3> "
readError
parseOutput:  ""
currentExpressionStatusChanged 2 "set (0, \"defaultfigurevisible\",\"off\");"
currentExpressionStatusChanged 1 "plot(1:1)"
readOutput
start parsing     "CANTOR_OCTAVE_BACKEND_PROMPT:4> "
readError
parseOutput:  ""
```
Comment 1 Egor Ignatov 2021-03-05 08:22:26 UTC
Fount this report (https://bugs.kde.org/show_bug.cgi?id=432892), so not only input functions stay looping forever.
Comment 2 Egor Ignatov 2021-03-05 08:56:06 UTC
Created attachment 136388 [details]
Cantor segfault backtrace

Also just discovered that a Segmentation fault occurs when you try to close the worksheet tab (ether with save changes or not) while it's in the 'calculation loop'.
Comment 3 Nikita Sirgienko 2021-03-09 09:00:50 UTC
Created attachment 136515 [details]
plot command run

Test reported issue, can't reproduse it
Comment 4 Nikita Sirgienko 2021-03-09 09:04:37 UTC
Hi, as you can see, I can't reproduse this issue.
Can you please run commands "available_graphics_toolkits()" and "graphics_toolkits()" Cantor and post result here.
Also, can you provide a screenshot from Octave settings ("Settings->Configure Cantor->Octave")?
Comment 5 Nikita Sirgienko 2021-03-09 09:08:33 UTC
And about https://bugs.kde.org/show_bug.cgi?id=432892 - I don't think, that you issue related to that report.
Input function hanging is well known, but the plot commands don't work with text input and use set of not fully supported commands, so I am sure, that your report about some Cantor bug or some problem with installation.
Comment 6 Egor Ignatov 2021-03-09 09:14:48 UTC
Created attachment 136517 [details]
graphics_toolkits
Comment 7 Egor Ignatov 2021-03-09 09:15:47 UTC
Created attachment 136519 [details]
settings screenshot
Comment 8 Nikita Sirgienko 2021-03-09 09:31:18 UTC
Well, this is also well known problem, that Octave plotting via ftlk can work incorrect and hang during plotting in some linux distros. At least in Cantor for sure.
So I think, you can try to disable "Embedded" option in Octave (but ftlt window can also hang itself) or run 'graphics_toolkit("gnuplot")' command before plot command and check, is that solves your problem with hanging. And if it have solves the problem, then you can just add the graphics toolkit change command in Cantor Octave autorun command, or in Octave startup file itelf.

Additional info about ftlk: On my Ubuntu 20.04 ftlk not working correctly like from Ubuntu 16.04. In early versions we just always have switched from ftlk to any other  graphics toolki, but Cantor have had some bugreports about this solution and additional research have showed, that on some distros its work smooth, so we stop to change toolkit and leave graphics toolkit manipulations in user's hand.
Comment 9 Egor Ignatov 2021-03-10 13:08:57 UTC
Thanks, everything works fine with gnuplot toolkit and octave 5.2,
but plotting still hangs if I use octave 6.2.

I know that Cantor recommends octave 5.2, so I don't expect it to
work, but maybe there are some workarounds?
Comment 10 Nikita Sirgienko 2021-03-10 20:15:49 UTC
Well, egori, I will test octave 6.2, but it is better, if you create separete bugreport about octave 6.2.
I have close this, because you say, that the problem have gone and "everything works fine".