chebfun gives Illegal instruction: 4

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

chebfun gives Illegal instruction: 4

idontgetoutmuch
I am trying to use chebfun (http://www.chebfun.org). I have

GNU Octave, version 5.1.0
Copyright (C) 2019 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-apple-darwin17.7.0".

Additional information about Octave is available at https://www.octave.org.

Please contribute if you find this software useful.
For more information, visit https://www.octave.org/get-involved.html

Read https://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1> x = chebfun('x');
Illegal instruction: 4

Here's a bit more information:

Process:               octave-gui [85121]
Path:                
/usr/local/Cellar/octave/5.1.0_4/libexec/octave/5.1.0/exec/x86_64-apple-darwin17.7.0/octave-gui
Identifier:            octave-gui
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        bash [528]
Responsible:           octave-gui [85121]
User ID:               501

Date/Time:             2019-05-18 09:59:18.450 +0100
OS Version:            Mac OS X 10.13.2 (17C88)
Report Version:        12
Bridge OS Version:     3.0 (14Y661)
Anonymous UUID:        AF192181-CF73-67FF-365C-5F82B37F98B9

Sleep/Wake UUID:       EC474B27-7272-4B77-99EE-428BBBEC2525

Time Awake Since Boot: 320000 seconds
Time Since Wake:       1900 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGILL)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Illegal instruction: 4
Termination Reason:    Namespace SIGNAL, Code 0x4
Terminating Process:   octave-gui [85121]





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

apjanke-floss

On 5/18/19 5:02 AM, idontgetoutmuch wrote:

> I am trying to use chebfun (http://www.chebfun.org). I have
>
> GNU Octave, version 5.1.0
> [...]> octave:1> x = chebfun('x');
> Illegal instruction: 4
>
> Here's a bit more information:
>
> Process:               octave-gui [85121]
> Path:                
> /usr/local/Cellar/octave/5.1.0_4/libexec/octave/5.1.0/exec/x86_64-apple-darwin17.7.0/octave-gui
> Identifier:            octave-gui
> Version:               0
> Code Type:             X86-64 (Native)
> Parent Process:        bash [528]
> Responsible:           octave-gui [85121]
> User ID:               501
>
> Date/Time:             2019-05-18 09:59:18.450 +0100
> OS Version:            Mac OS X 10.13.2 (17C88)
> [...]

I can reproduce this.

$ octave -q
octave:1> addpath ~/tmp/chebfun/chebfun-master
octave:2> x = chebfun('x')
[1]    734 illegal hardware instruction (core dumped)  octave -q
[/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks]
$ octave --version
GNU Octave, version 5.1.0

This is on macOS 10.14.5 on my Late 2015 iMac 5K. Happens with either
Octave.app 4.4.1 GUI, Octave.app 5.1.0 beta GUI, or Homebrew-installed
Octave 5.1.0_4 CLI.

Here's a crash dump:

https://github.com/octave-app/octave-app/files/3194133/octave-gui_2019-05-18-100317_angharad-running-chebfun.crash.zip

Normally problems with libraries should be reported to the library
maintainers themselves, but since this is causing a low-level error like
an illegal instruction or other crash, that suggests that it's
encountering a bug in Octave itself.

idontgetoutmuch, what model of Mac are you using (type and release
year), so we can figure out what CPU model you have? That's often
relevant to Illegal Instruction errors; they usually mean that you're
running binary code that was compiled for a newer generation of CPU than
yours. Though it's somewhat surprising here: You have a
Homebrew-installed Octave, and Homebrew's bottle distribution has
binaries that are built for Core 2, for wide compatibility. And my iMac,
which is also getting an Illegal Instruction, has a quite new i7-6700K
Skylake CPU, so it should be able to run anything.

The zero-arg `chebfun()` constructor does not crash.

I threw it in the debugger.

Looks like it's happening at line 230 in @chebfun/chebfun.m, where it
does this:

                f.pointValues = chebfun.getValuesAtBreakpoints(f.funs, ...
                    f.domain, op);

That `f.domain` expression is resolving to the "domain" method defined
in @chebfun/domain.m. (I can tell because that's where I end up when I
do a `dbstep in` on that line.) The weird thing is that the @chebfun
class defines both a "domain" method (not "set.domain"/"get.domain"
accessors) and a "domain" property.

The domain method in turn is calling f.domain:

elseif ( numel(f) == 1 )
    % CHEBFUN case:
    A = f.domain;

Which seems like it's intended to get the property?

To be honest, I'm not sure what's supposed to happen in this case where
you have both a method and a property with the same name. (And the
method is not declared with a prototype in the classdef.) But I do know
that a crash is not the right behavior. :) I would think that, even
inside the class definition code, it would always resolve to one or the
other (since we're not dealing with subsref here), and it would either
always get the property directly, or it would turn into an infinite
recursion, since "f.domain" would mean a method call even inside the
domain() method definition. So I'm kind of surprised that this chebfun
code works under Matlab as is.

If I call `f.domain` interactively while stopped in the constructor in
the debugger, it also crashes Octave. So I suspect that's what's doing it.

I can reproduce the Illegal Instruction crash with this simple repro case:

$ cat Recurser.m
classdef Recurser
  properties
    domain
  endproperties
  methods
    function out = domain(this)
      out = this.domain;
    endfunction
  endmethods
endclassdef
[~/Documents/octave]
$ octave
octave:1> r = Recurser;
octave:2> r.domain
[1]    2292 illegal hardware instruction (core dumped)  octave -q
[~/Documents/octave]
$

So, maybe what's happening is that the infinite-recursion case is
kicking in, and Octave doesn't handle that gracefully?

Cheers,
Andrew


Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

Dmitri A. Sergatskov
On linux I get:

octave:1>  x = chebfun('x');
error: max_recursion_depth exceeded
error: called from
    domain at line 28 column 7
    chebfun at line 230 column 31

Dmitri.
--


Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

Dmitri A. Sergatskov
On Sat, May 18, 2019 at 9:42 AM Dmitri A. Sergatskov
<[hidden email]> wrote:

>
> On linux I get:
>
> octave:1>  x = chebfun('x');
> error: max_recursion_depth exceeded
> error: called from
>     domain at line 28 column 7
>     chebfun at line 230 column 31
>
> Dmitri.

And similarly with Recurser example:
octave:1> r = Recurser;
octave:2> r.domain
error: max_recursion_depth exceeded
error: called from
    domain at line 7 column 11
octave:2>

(no crash in either case).

Dmitri.
--


Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

idontgetoutmuch
In reply to this post by apjanke-floss
Thanks very much for taking a look at this (and in such depth). I did find this on the chebfun website: "No, Chebfun does not work in Octave, because it relies too intimately on the object-oriented features of MATLAB.” which I posted on #octave earlier (when I thought my email had not been received). But I agree it should not produce an illegal instruction.

I am sad that I can’t use chebfun but it is not essential to what I am doing.

Thanks once again.

Dominic Steinitz
Twitter: @idontgetoutmuch


On 18 May 2019, at 15:35, Andrew Janke <[hidden email]> wrote:


On 5/18/19 5:02 AM, idontgetoutmuch wrote:
I am trying to use chebfun (http://www.chebfun.org). I have

GNU Octave, version 5.1.0
[...]> octave:1> x = chebfun('x');
Illegal instruction: 4

Here's a bit more information:

Process:               octave-gui [85121]
Path:                 
/usr/local/Cellar/octave/5.1.0_4/libexec/octave/5.1.0/exec/x86_64-apple-darwin17.7.0/octave-gui
Identifier:            octave-gui
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        bash [528]
Responsible:           octave-gui [85121]
User ID:               501

Date/Time:             2019-05-18 09:59:18.450 +0100
OS Version:            Mac OS X 10.13.2 (17C88)
[...]

I can reproduce this.

$ octave -q
octave:1> addpath ~/tmp/chebfun/chebfun-master
octave:2> x = chebfun('x')
[1]    734 illegal hardware instruction (core dumped)  octave -q
[/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks]
$ octave --version
GNU Octave, version 5.1.0

This is on macOS 10.14.5 on my Late 2015 iMac 5K. Happens with either
Octave.app 4.4.1 GUI, Octave.app 5.1.0 beta GUI, or Homebrew-installed
Octave 5.1.0_4 CLI.

Here's a crash dump:

https://github.com/octave-app/octave-app/files/3194133/octave-gui_2019-05-18-100317_angharad-running-chebfun.crash.zip

Normally problems with libraries should be reported to the library
maintainers themselves, but since this is causing a low-level error like
an illegal instruction or other crash, that suggests that it's
encountering a bug in Octave itself.

idontgetoutmuch, what model of Mac are you using (type and release
year), so we can figure out what CPU model you have? That's often
relevant to Illegal Instruction errors; they usually mean that you're
running binary code that was compiled for a newer generation of CPU than
yours. Though it's somewhat surprising here: You have a
Homebrew-installed Octave, and Homebrew's bottle distribution has
binaries that are built for Core 2, for wide compatibility. And my iMac,
which is also getting an Illegal Instruction, has a quite new i7-6700K
Skylake CPU, so it should be able to run anything.

The zero-arg `chebfun()` constructor does not crash.

I threw it in the debugger.

Looks like it's happening at line 230 in @chebfun/chebfun.m, where it
does this:

               f.pointValues = chebfun.getValuesAtBreakpoints(f.funs, ...
                   f.domain, op);

That `f.domain` expression is resolving to the "domain" method defined
in @chebfun/domain.m. (I can tell because that's where I end up when I
do a `dbstep in` on that line.) The weird thing is that the @chebfun
class defines both a "domain" method (not "set.domain"/"get.domain"
accessors) and a "domain" property.

The domain method in turn is calling f.domain:

elseif ( numel(f) == 1 )
   % CHEBFUN case:
   A = f.domain;

Which seems like it's intended to get the property?

To be honest, I'm not sure what's supposed to happen in this case where
you have both a method and a property with the same name. (And the
method is not declared with a prototype in the classdef.) But I do know
that a crash is not the right behavior. :) I would think that, even
inside the class definition code, it would always resolve to one or the
other (since we're not dealing with subsref here), and it would either
always get the property directly, or it would turn into an infinite
recursion, since "f.domain" would mean a method call even inside the
domain() method definition. So I'm kind of surprised that this chebfun
code works under Matlab as is.

If I call `f.domain` interactively while stopped in the constructor in
the debugger, it also crashes Octave. So I suspect that's what's doing it.

I can reproduce the Illegal Instruction crash with this simple repro case:

$ cat Recurser.m
classdef Recurser
 properties
   domain
 endproperties
 methods
   function out = domain(this)
     out = this.domain;
   endfunction
 endmethods
endclassdef
[~/Documents/octave]
$ octave
octave:1> r = Recurser;
octave:2> r.domain
[1]    2292 illegal hardware instruction (core dumped)  octave -q
[~/Documents/octave]
$

So, maybe what's happening is that the infinite-recursion case is
kicking in, and Octave doesn't handle that gracefully?

Cheers,
Andrew



Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

José Abílio Matos
On Saturday, 18 May 2019 16.07.39 WEST [hidden email] wrote:

> Thanks very much for taking a look at this (and in such depth). I did find
> this on the chebfun website: "No, Chebfun does not work in Octave, because
> it relies too intimately on the object-oriented features of MATLAB.” which
> I posted on #octave earlier (when I thought my email had not been
> received). But I agree it should not produce an illegal instruction.
>
> I am sad that I can’t use chebfun but it is not essential to what I am
> doing.
>
> Thanks once again.

As far as I remember these problems should be mitigated in octave 6, due to
jwe work with the object oriented interface.

Running this on octave 6 (development) I get (after changing to the chebfun-
master directory):

>> addpath(pwd())
>> x = chebfun('x');
error: octave_base_value::bool_value(): wrong type argument 'sq_string'
error: called from
    chebfun at line 219 column 36


One of the reasons why I follow more or less this issue is because I am
involved in a more or less related project:
https://cmup.fc.up.pt/tautoolbox/index.html

Regards,
--
José Matos




Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

apjanke-floss


On 5/18/19 12:41 PM, José Abílio Matos wrote:

> On Saturday, 18 May 2019 16.07.39 WEST [hidden email] wrote:
>> Thanks very much for taking a look at this (and in such depth). I did find
>> this on the chebfun website: "No, Chebfun does not work in Octave, because
>> it relies too intimately on the object-oriented features of MATLAB.” which
>> I posted on #octave earlier (when I thought my email had not been
>> received). But I agree it should not produce an illegal instruction.
>>
>> I am sad that I can’t use chebfun but it is not essential to what I am
>> doing.
>>
>> Thanks once again.
>
> As far as I remember these problems should be mitigated in octave 6, due to
> jwe work with the object oriented interface.
>
> Running this on octave 6 (development) I get (after changing to the chebfun-
> master directory):
>
>>> addpath(pwd())
>>> x = chebfun('x');
> error: octave_base_value::bool_value(): wrong type argument 'sq_string'
> error: called from
>     chebfun at line 219 column 36
>
>
> One of the reasons why I follow more or less this issue is because I am
> involved in a more or less related project:
> https://cmup.fc.up.pt/tautoolbox/index.html
>
> Regards,
>

On macOS 10.14.5 on a Late 2015 iMac 5K with a fresh build from the
default branch tonight (2019-05-19), I get this:

$ octave-default -q
octave:1> addpath ~/tmp/chebfun/chebfun-master
octave:2> x = chebfun('x')
error: 'sampleTest' undefined near line 89 column 15
error: called from
    happinessCheck at line 89 column 13
    populate at line 116 column 23
    chebtech2 at line 102 column 27
    constructor at line 57 column 17
    constructor at line 71 column 21
    bndfun at line 103 column 24
    constructor at line 100 column 21
    constructor at line 51 column 21
    constructor>getFun at line 276 column 3
    constructor>constructorNoSplit at line 110 column 37
    constructor at line 63 column 18
    chebfun at line 219 column 36
octave:2> ver
----------------------------------------------------------------------
GNU Octave Version: 6.0.0 (hg id: f16471efcdf4 + patches)
GNU Octave License: GNU General Public License
Operating System: Darwin 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25
23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
----------------------------------------------------------------------
Package Name  | Version | Installation directory
--------------+---------+-----------------------
     control  |   3.2.0 | /Users/janke/octave/control-3.2.0
      signal  |   1.4.1 | /Users/janke/octave/signal-1.4.1
octave:3>


I have to admit that I'm too lazy to chase that stack trace down, since
it doesn't have class qualifiers in it. But I think this is better than
a crash!

This was from a Homebrew-installed
`octave-app/octave-app/octave-default` on 2019-05-19 at 03:30 Eastern.

Cheers,
Andrew


Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

José Abílio Matos
On Sunday, 19 May 2019 08.32.12 WEST Andrew Janke wrote:
> This was from a Homebrew-installed
> `octave-app/octave-app/octave-default` on 2019-05-19 at 03:30 Eastern.
>
> Cheers,
> Andrew

For further comparison I am running octave in place (no installation). I get
(in Fedora 30)

$ ./run-octave -q
octave:1> addpath ~/tmp/chebfun/chebfun-master
octave:2> x = chebfun('x')
error: octave_base_value::bool_value(): wrong type argument 'sq_string'
error: called from
    chebfun at line 219 column 36
octave:2> ver
----------------------------------------------------------------------
GNU Octave Version: 6.0.0 (hg id: 5fa8d1459b35)
GNU Octave License: GNU General Public License
Operating System: Linux 5.1.2-300.fc30.x86_64 #1 SMP Tue May 14 23:58:18 UTC
2019 x86_64
----------------------------------------------------------------------
Package Name  | Version | Installation directory
--------------+---------+-----------------------
       optim  |   1.6.0 | /home/jamatos/.local/share/octave/optim-1.6.0
    symbolic  |   2.7.1 | /home/jamatos/.local/share/octave/symbolic-2.7.1


If I try to get the backtrace it fails right when entering the line

[f.funs, f.domain] = chebfun.constructor(op, dom, data, pref);

Using "Step in" when debugging gives the above error message. it does not even
enter the function.

For reference I am using gcc 9.1.1

Regards,
--
José Matos





Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

Dmitri A. Sergatskov
On Tue, May 21, 2019 at 4:18 AM José Abílio Matos <[hidden email]> wrote:

>
> On Sunday, 19 May 2019 08.32.12 WEST Andrew Janke wrote:
> > This was from a Homebrew-installed
> > `octave-app/octave-app/octave-default` on 2019-05-19 at 03:30 Eastern.
> >
> > Cheers,
> > Andrew
>
> For further comparison I am running octave in place (no installation). I get
> (in Fedora 30)
>
> $ ./run-octave -q
> octave:1> addpath ~/tmp/chebfun/chebfun-master
> octave:2> x = chebfun('x')
> error: octave_base_value::bool_value(): wrong type argument 'sq_string'
> error: called from
>     chebfun at line 219 column 36
> octave:2> ver
> ----------------------------------------------------------------------
> GNU Octave Version: 6.0.0 (hg id: 5fa8d1459b35)
> GNU Octave License: GNU General Public License
> Operating System: Linux 5.1.2-300.fc30.x86_64 #1 SMP Tue May 14 23:58:18 UTC
> 2019 x86_64
> ----------------------------------------------------------------------
> Package Name  | Version | Installation directory
> --------------+---------+-----------------------
>        optim  |   1.6.0 | /home/jamatos/.local/share/octave/optim-1.6.0
>     symbolic  |   2.7.1 | /home/jamatos/.local/share/octave/symbolic-2.7.1
>
>
> If I try to get the backtrace it fails right when entering the line
>
> [f.funs, f.domain] = chebfun.constructor(op, dom, data, pref);
>
> Using "Step in" when debugging gives the above error message. it does not even
> enter the function.
>
> For reference I am using gcc 9.1.1
>

I think there is a problem with your build. i am getting the same
errrors as Andrew J.
Did you do "make check" and did it pass?

> Regards,
> --
> José Matos
>

Sincerely,

Dmitri.
--


Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

José Abílio Matos
On Tuesday, 21 May 2019 16.19.00 WEST Dmitri A. Sergatskov wrote:
> I think there is a problem with your build. i am getting the same
> errrors as Andrew J.
> Did you do "make check" and did it pass?

$ make check
...
Summary:

  PASS                            15631
  FAIL                                0
  XFAIL (reported bug)               24
  SKIP (missing feature)             44
  SKIP (run-time condition)          12


Looking to skips I get:
jit.tst
testfun/test.m
ode/ode15s.m
ode/ode15i.m

The run-time condition failled are:
libinterp/corefcn/sysdep.cc-tst


I have decided to start fresh and so I have removed the ~/.ccache directory.

$ make clean
$ make
$ make check

I get exactly the same results... :-(
--
José Matos





Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

Dmitri A. Sergatskov
On Tue, May 21, 2019 at 3:13 PM José Abílio Matos <[hidden email]> wrote:

>
> I get exactly the same results... :-(

Did you re-run bootstrup before configure?
Just to make sure start with new hg clone.


> --
> José Matos
>

Dmitri.
--


Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

José Abílio Matos
On Tuesday, 21 May 2019 21.27.05 WEST you wrote:
> Did you re-run bootstrup before configure?
> Just to make sure start with new hg clone.

No change. :-(

I have deleted the build directory and started anew. I have also created a new
hg clone and started from there.

I have repeated the same procedure in another machine and I am able to
reproduce your results. I am baffled. :-(

Comparing the configure.log files for both machines does not seem to show any
relevant difference.

In this machine /bin is in the path (/bin is a symbolic link to /usr/bin in
both).

There are some locales that are not installed in the other machine.

The only other difference is the following (- for this machine and + for the
machine where there is no issue):

-gl_cv_func_mbrtowc_incomplete_state=yes
-gl_cv_func_mbrtowc_nul_retval=yes
-gl_cv_func_mbrtowc_null_arg1=yes
-gl_cv_func_mbrtowc_null_arg2=yes
-gl_cv_func_mbrtowc_retval=yes
-gl_cv_func_mbrtowc_sanitycheck=yes
-gl_cv_func_mbsrtowcs_works=yes
+gl_cv_func_mbrtowc_incomplete_state='guessing yes'
+gl_cv_func_mbrtowc_nul_retval='guessing yes'
+gl_cv_func_mbrtowc_null_arg1='guessing yes'
+gl_cv_func_mbrtowc_null_arg2='guessing yes'
+gl_cv_func_mbrtowc_retval='guessing yes'
+gl_cv_func_mbrtowc_sanitycheck='guessing yes'
+gl_cv_func_mbsrtowcs_works='guessing yes'
 
--
José Matos




Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

Dmitri A. Sergatskov
On Wed, May 22, 2019 at 10:02 AM José Abílio Matos <[hidden email]> wrote:

>
> On Tuesday, 21 May 2019 21.27.05 WEST you wrote:
> > Did you re-run bootstrap before configure?
> > Just to make sure start with new hg clone.
>
> No change. :-(
>
> I have deleted the build directory and started anew. I have also created a new
> hg clone and started from there.
>

The symptoms are indicative that you have either another older octave
installed somewhere and
the its libraries got crosslinked into you newly build octave.

updatedb; locate octave

etc...

Dmitri.
--


Reply | Threaded
Open this post in threaded view
|

Re: chebfun gives Illegal instruction: 4

José Abílio Matos
On Wednesday, 22 May 2019 16.10.27 WEST Dmitri A. Sergatskov wrote:
> The symptoms are indicative that you have either another older octave
> installed somewhere and
> the its libraries got crosslinked into you newly build octave.
>
> updatedb; locate octave
>
> etc...
>
> Dmitri.

Of course I have another octave installed. This is the development version and
so I need a stable version installed. :-)

In any case in the machine where the problem occurs I have octave 5.1
installed while in the machine where the problem does not occur I have octave
4.4 installed.

In the first case it was installed from copr (a ppa in ubuntu parlance) and
the other is the version available in Fedora. In both cases the versions have
been installed using dnf.

The strange part is that make check report the same numbers of the tests
passes, skipped and so on.

PS: Thank you for helping me debug this issue. :-)
--
José Matos