bugGNU Octave - Bugs: bug #55029, pause causes hang

 
 

bug #55029: pause causes hang

Submitted by:  Michael Godfrey <godfrey>
Submitted on:  Thu 15 Nov 2018 01:48:54 PM UTC  
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Works For Me Assigned to:  None
Originator Name:  Godfrey Open/Closed:  Open
Release:  dev Operating System:  GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Fri 23 Nov 2018 04:39:16 PM UTC, comment #42:

On Fedora 28 it is kind of hit-and-miss:

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 23 Nov 2018 04:03:45 PM UTC, comment #41:

All my tests are on fc29. That is all I have right now.

Michael Godfrey <godfrey>
Project Member
Fri 23 Nov 2018 04:02:05 PM UTC, comment #40:

I think that what I got is consistent with Dmitri:

I also tried:
octave:19> disp ("Type a character")
Type a character
octave:20> pause (15)
c=kbhit(0)
a
octave:21> c=kbhit(0)
c =

==================
I extended the time to 15sec so that I could enter
c=kbhit(0)
a
before time ran out.

Michael Godfrey <godfrey>
Project Member
Fri 23 Nov 2018 03:35:43 PM UTC, comment #39:

Or if I wait to type c = kbhit (0) until octave's prompt returns:

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 23 Nov 2018 03:29:32 PM UTC, comment #38:

This is what I get with the current dev:

(On Fedora 29)

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 23 Nov 2018 02:21:35 PM UTC, comment #37:

@Michael: could you run the following snippet (as a script or including the last newline) in F28 and F29. You will be prompted to type a character and you'll have 5 seconds to do so.

For me kbhit always returns the character I have typed.

Pantxo Diribarne <pantxo>
Project Member
Thu 22 Nov 2018 10:29:13 PM UTC, comment #36:

John,

Since you are the author of sysdep.cc which containd
kbhit (), do you have an idea of why it is broken in
Fedora 29?

Michael Godfrey <godfrey>
Project Member
Sat 17 Nov 2018 07:30:26 PM UTC, comment #35:

Right. pause breaks kbhit.
But only, it appears, on FC29!

Michael Godfrey <godfrey>
Project Member
Fri 16 Nov 2018 09:09:18 PM UTC, comment #34:

I also observe the following on Fedora 29. When Octave starts, the 'kbhit' function behaves correctly. However, after calling 'pause' with no arguments, and breaking out of it with Ctrl+C, the 'kbhit' function now returns an empty string immediately for the remainder of the Octave session. This agrees with the change that Dmitri bisected to, which uses 'octave::kbhit' inside of an infinite loop. The 'octave::kbhit' function continues to return -1 inside that loop, no matter how many keys are pressed, so the loop is never broken until the user issues an interrupt.

Mike Miller <mtmiller>
Project Administrator
Fri 16 Nov 2018 08:51:24 PM UTC, comment #33:

I booted a Fedora 28 VM, compiled the default version of Octave, then upgraded the VM to Fedora 29 and ran the same compiled Octave without rebuilding anything. I can confirm that the pause function returns immediately on a key press on Fedora 28, but the upgrade to Fedora 29 breaks it. The character corresponding to the key pressed is shown in both cases, that doesn't seem to be related to the pause function not returning at all.

Mike Miller <mtmiller>
Project Administrator
Fri 16 Nov 2018 08:39:07 PM UTC, comment #32:

https://hg.savannah.gnu.org/hgweb/octave/rev/f7b205562f1d

Looks like the bad revision.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 16 Nov 2018 07:58:39 PM UTC, comment #31:

So far I braketed the problem between
HG ID "553278e5aac7" (good)
and
HG ID "f881d3e271d2" (bad)

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Fri 16 Nov 2018 07:14:45 PM UTC, comment #30:

I can also confirm that hg id 1c6dd836bca9
(pre 511295347a27) still has a problem on my (Fedora 29) computer.

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Fri 16 Nov 2018 06:17:22 PM UTC, comment #29:

Thanks, so this does affect the default branch only, but is only reproducible on Fedora 29.

Mike Miller <mtmiller>
Project Administrator
Fri 16 Nov 2018 06:14:43 PM UTC, comment #28:

To clarify my statement:
I still have a coputer with Fedora 28 on it. i just built
a current dev tip and it does not show the problem.

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Fri 16 Nov 2018 06:10:37 PM UTC, comment #27:

Dimitri said:
BTW -- I tried on Fedora 28 computer and I do not see this bug there. I doubt
Fedora changed terminal interface between those
two versions.

Dmitri.

The problem could have been present in FC28. I only needed
pause in my code when I found that plots executed from
a file were causing seg fault and needed pause to prevent
this (this is an old problem solved quite a long time ago
but reintroduced recently (bug #55028)).

Michael Godfrey <godfrey>
Project Member
Fri 16 Nov 2018 05:49:03 PM UTC, comment #26:

No -- by mistake i was applying to stable branch that is why the patch was rejected. When i applied to dev, instead of fix I got even worse behaviour.

BTW -- I tried on Fedora 28 computer and I do not see this bug there. I doubt Fedora changed terminal interface between those
two versions.

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Fri 16 Nov 2018 05:44:05 PM UTC, comment #25:

Dmitri - are you implying that this bug affects the stable branch for you as well? Does it affect the 4.4.1 tagged release also? If so, is it possible this is a bug in a Fedora library since the latest distro update to F29 and not a bug in Octave?

Mike Miller <mtmiller>
Project Administrator
Fri 16 Nov 2018 05:40:48 PM UTC, comment #24:

hg update -r 511295347a27^ did not fix the problem.
Sorry.

Michael Godfrey <godfrey>
Project Member
Fri 16 Nov 2018 05:31:10 PM UTC, comment #23:

Sorry -- I was applying the patch to stable...
It applied fine to dev, but behaviour got even worse,
now the typed chars only show up on the second try (i.e.
typing "x" after pause would not show up anything, typing
"x" again would show up "x" etc... Ctrl-C returns to
octave prompt).

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 16 Nov 2018 05:10:45 PM UTC, comment #22:

I attached an updated version of the patch, with a log and an implementation for Windows also. As for sgtty terminal interface, the "raw_mode" function was already incomplete and I don't expect modern platforms to not have termios or termio at least.

@Dmitri: That is strange, I can't imagine why a patch could be entirely rejected...

(file #45455)

Pantxo Diribarne <pantxo>
Project Member
Fri 16 Nov 2018 05:09:42 PM UTC, comment #21:

Rik's suggestion is did not crash, but it backed out about 90
patches so it is taking a while to compile. And, this
will add to the problem of isolating the error.

More when compile completes.

Michael Godfrey <godfrey>
Project Member
Fri 16 Nov 2018 05:01:54 PM UTC, comment #20:

Patch failed for me:

patch -p1 < ~/Downloads/pause_timeout.patch
patching file libinterp/corefcn/sysdep.cc
Hunk #1 FAILED at 358.
Hunk #2 FAILED at 405.
Hunk #3 FAILED at 448.
Hunk #4 FAILED at 540.
Hunk #5 FAILED at 549.
5 out of 5 hunks FAILED -- saving rejects to file libinterp/corefcn/sysdep.cc.rej
patching file libinterp/corefcn/sysdep.h
Hunk #1 FAILED at 40.
1 out of 1 hunk FAILED -- saving rejects to file libinterp/corefcn/sysdep.h.rej
patching file libinterp/corefcn/utils.cc
Hunk #1 FAILED at 1287.
1 out of 1 hunk FAILED -- saving rejects to file libinterp/corefcn/utils.cc.rej

Dmitri A. Sergatskov <dasergatskov>
Fri 16 Nov 2018 04:38:52 PM UTC, comment #19:

I attached a patch that fixes the echoed character for me, but it is incomplete: it won't work on BSD platforms which use sgtty terminal interface and for which I couldn't find a way to add a timeout to the raw mode.

(file #45453)

Pantxo Diribarne <pantxo>
Project Member
Fri 16 Nov 2018 04:31:30 PM UTC, comment #18:

I assume you have a Mercurial clone of the development branch. Try updating to the parent of the problem changeset.

The '^' asks Mercurial for the parent of the named revision.

Once there, build as usual, run-octave, try pause() and see if it hangs.

--Rik

Rik <rik5>
Project Administrator
Fri 16 Nov 2018 04:19:51 PM UTC, comment #17:

@Pantxo Can this be tested by just backing out cset 511295347a27?
Any other changes neeeded? If not please tell where to find the cset and how to do the backout. I have done this before, but
not recently.

Thanks, Michael

Michael Godfrey <godfrey>
Project Member
Fri 16 Nov 2018 08:12:59 AM UTC, comment #16:

I'd bet the bisection is not necessary, I'm 99% sure it's due to cset 511295347a27. As for the system dependent behavior, we use a "raw_mode" function to capture keyboard entries and the implementation depends on the kind of terminal interface in use (termio, termios or stty).
If someone can confirm that cset 511295347a27 is at fault, I'll try to rework this.

Pantxo Diribarne <pantxo>
Project Member
Fri 16 Nov 2018 12:45:46 AM UTC, comment #15:

Like Mike, I'm also using readline 7.0 and it works for me. I'm running Kubuntu 18.04 which is based off Debian, so relatively similar platforms.

Rik <rik5>
Project Administrator
Fri 16 Nov 2018 12:24:30 AM UTC, comment #14:

@Dimitri

I tried compared ./run-octave with ./run-octave -cli?

They behave the same.

Michael Godfrey <godfrey>
Project Member
Fri 16 Nov 2018 12:17:37 AM UTC, comment #13:

I also noticed that now in my history I have (hitting arrow up):

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Fri 16 Nov 2018 12:07:48 AM UTC, comment #12:

I am not able to reproduce this on Debian with readline 7.0. I tested both with libreadline7 provided by Debian (currently at 7.0 patchlevel 3) and with my own self-built readline from git (currently at 7.0 patchlevel 5).

Are the only users affected by this on Fedora 29?

Has anyone affected by this compared ./run-octave with ./run-octave -cli?

Mike Miller <mtmiller>
Project Administrator
Thu 15 Nov 2018 11:27:51 PM UTC, comment #11:

One item might help: Those who have some version of this
problem could report what their system is...

Michael Godfrey <godfrey>
Project Member
Thu 15 Nov 2018 11:26:09 PM UTC, comment #10:

@Rik,

I get:
[godfrey@pbdsl4 ~]$ octave -f -q --no-line-editing
octave:1> pause
aaaa^C
octave:1>

As you said, I also get

>>without readline, octave quits on Ctrl-C (rather than returning to interpreter).

Michael Godfrey <godfrey>
Project Member
Thu 15 Nov 2018 11:03:08 PM UTC, comment #9:

Okay, someone who has this problem will have to try bisection.

Rik <rik5>
Project Administrator
Thu 15 Nov 2018 11:00:25 PM UTC, comment #8:

without readline, octave quits on Ctrl-C (rather than returning to interpreter). Pause still ignores keybord input.

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Thu 15 Nov 2018 10:54:32 PM UTC, comment #7:

@Michael: Maybe try disabling readline entirely?

Otherwise, you might have to try using hg bisect to figure out where this was introduced.

Works fine for me though with current tip (32d4ee071348). As soon as I type the first key ('x') Octave returns to the prompt.

Rik <rik5>
Project Administrator
Thu 15 Nov 2018 10:50:12 PM UTC, comment #6:

Just to keep up-to-date, I am now testing with:
octave:1> _octave_config_info_ ("hg_id")
ans = 8b6f1731474b

Michael Godfrey <godfrey>
Project Member
Thu 15 Nov 2018 10:42:08 PM UTC, comment #5:

@Rik: about:
You might also want to move your .inputrc file to a new name in case Readline
is causing the issue.

I did check that. No .inputrc or .octaverc are in my
home dir. (Remember the trouble with that before...)

Michael Godfrey <godfrey>
Project Member
Thu 15 Nov 2018 10:37:02 PM UTC, comment #4:

@Dimitri That is exactly what I reported.

and:

>>@Michael: Maybe try starting with '-f' to avoid reading any configuration files in case it is something with your personal .octaverc or with the OS' base configuration.


Tried that:
octave:1> pause
xxx^C
octave:1>

No change in behavior.

Michael Godfrey <godfrey>
Project Member
Thu 15 Nov 2018 10:30:48 PM UTC, comment #3:

I can (kind of) reproduce the problem.

After pause octave suspends, and I need to hit Ctrl-C to return to
octave prompt.

Version 4.4.1
works fine on the same computer.

Dmitri.

Dmitri A. Sergatskov <dasergatskov>
Thu 15 Nov 2018 10:10:55 PM UTC, comment #2:

There might be something else going on. pause with no argument works for me. I tried both CLI and GUI versions of Octave.

@Michael: Maybe try starting with '-f' to avoid reading any configuration files in case it is something with your personal .octaverc or with the OS' base configuration.

You might also want to move your .inputrc file to a new name in case Readline is causing the issue.

Rik <rik5>
Project Administrator
Thu 15 Nov 2018 07:23:12 PM UTC, comment #1:

This is most probably due to the changes for bug #53729, which is still marked "Ready for test". Can you add a comment there?

Pantxo Diribarne <pantxo>
Project Member
Thu 15 Nov 2018 01:48:54 PM UTC, original submission:

As of HG 1861e2ea0a4b pause
with no argument hangs Octave.
Typing any character or CR only echos the text.
^C is required to exit Octave.

Again this is using FC29 current update.

Michael Godfrey <godfrey>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #45455:  pause_timeout2.patch added by pantxo (4KiB - text/x-patch)
file #45453:  pause_timeout.patch added by pantxo (3KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by godfrey (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-11-16 pantxo Attached File- => Added pause_timeout2.patch, #45455
    2018-11-16 pantxo Attached File- => Added pause_timeout.patch, #45453
    2018-11-15 rik5 StatusNone => Works For Me

    Back to the top


    Powered by Savane 3.3