Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack overflow is unreliable #503

Closed
extemporaneousb opened this issue Mar 2, 2012 · 8 comments
Closed

stack overflow is unreliable #503

extemporaneousb opened this issue Mar 2, 2012 · 8 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@extemporaneousb
Copy link

Simple example below shows a segmentation fault for a recursive function call.

thanks, jim

           _

_ _ ()_ |
() | () () | A fresh approach to technical computing
_ _ | | __ _ |
| | | | | | |/ ` | | Version 0.0.0-prerelease
| | |
| | | | (
| | | Commit c84deda (2012-02-28 19:39:42)
/ |_'|||__'| |
|__/ |

julia> f(n) = if (n == 0) 0 else f(n-1) + n
end

julia> f(10)
55

julia> f(10000000000)
Segmentation fault: 11

@ghost ghost assigned JeffBezanson Mar 2, 2012
@StefanKarpinski
Copy link
Member

I just get a stack overflow:

julia> f(n) = if (n == 0) 0 else f(n-1) + n end

julia> f(10)
55

julia> f(10000000000)
error: stack overflow

Can you do two things: 1) send system details, 2) try a newer julia version.

@StefanKarpinski
Copy link
Member

Ah, interesting. I get different errors on different runs. Sometimes I get a stack overflow, other times segfault, still others illegal hardware instructions. There's definitely something messy going on here.

@StefanKarpinski
Copy link
Member

Basically, I think this comes down to stack overflow detection being somewhat unstable.

@JeffBezanson
Copy link
Member

Leaving an asynch signal handler is not required to work.
On Mar 2, 2012 10:02 AM, "Stefan Karpinski" <
[email protected]>
wrote:

Basically, I think this comes down to stack overflow detection being
somewhat unstable.


Reply to this email directly or view it on GitHub:
#503 (comment)

@leviboyles
Copy link

I think I'm running into the same issue with object printing. I have a doubly-linked tree structure and if I forget the ";" in the julia shell when I construct it, I will get hanging/segfault/hardware instruction errors.

@staticfloat
Copy link
Member

Just for fun, I was trying this out, and I can't seem to get it to segfault at all on OSX or Ubuntu. Could this have fixed itself with all the signal handling improvements made recently? I also noticed that while Ubuntu barrages me with output:

julia> f(1000000)
error: stack overflow
 in f at none:1
...
 in f at none:1

julia>

OS X is comparatively stingy with its output:

julia> f(1000000)
error: stack overflow

julia>

Is this because OSX doesn't have libunwind?

@vtjnash
Copy link
Member

vtjnash commented Feb 1, 2013

@JeffBezanson is there actually some goal of providing a patch for this, or can it just be closed as wontfix? (I can't get this to segfault at all on Mac64 or Ubuntu32, even with dozens of repeat executions)

as a sidenote, OSX now has libunwind, and prints the full, long backtrace

@vtjnash
Copy link
Member

vtjnash commented Feb 1, 2013

this potentially had been improved by 72793ed. see also #1485

Keno pushed a commit that referenced this issue Oct 9, 2023
The main challenge is to support nested calls. Now that `FrameData.callargs` is not shared across frames, this is doable.

Co-authored-by: Kristoffer Carlsson <[email protected]>
Co-authored-by: Shuhei Kadowaki <[email protected]>
jishnub pushed a commit that referenced this issue Feb 16, 2024
Stdlib: SparseArrays
URL: https://github.com/JuliaSparse/SparseArrays.jl.git
Stdlib branch: main
Julia branch: master
Old commit: c9f7293
New commit: cb602d7
Julia version: 1.12.0-DEV
SparseArrays version: 1.11.0(Does not match)
Bump invoked by: @dkarrasch
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaSparse/SparseArrays.jl@c9f7293...cb602d7

```
$ git log --oneline c9f7293..cb602d7
cb602d7 Add generic matmatmul for inplace sparse x sparse (#486)
95575c0 Speedup for `findmin()/findmax()` on sparse arrays (#510) (#511)
4cc31f2 Fix error message in getcommon() in cholmod (#509)
1748989 Move `fkeep!` docstring to the right function (#503)
1aa6431 Update ci.yml timeout (#507)
1f88ae1 Update ci.yml  - add codecov token (#504)
```

Co-authored-by: Dilum Aluthge <[email protected]>
KristofferC pushed a commit that referenced this issue Feb 26, 2024
Stdlib: SparseArrays
URL: https://github.com/JuliaSparse/SparseArrays.jl.git
Stdlib branch: main
Julia branch: master
Old commit: c9f7293
New commit: cb602d7
Julia version: 1.12.0-DEV
SparseArrays version: 1.11.0(Does not match)
Bump invoked by: @dkarrasch
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaSparse/SparseArrays.jl@c9f7293...cb602d7

```
$ git log --oneline c9f7293..cb602d7
cb602d7 Add generic matmatmul for inplace sparse x sparse (#486)
95575c0 Speedup for `findmin()/findmax()` on sparse arrays (#510) (#511)
4cc31f2 Fix error message in getcommon() in cholmod (#509)
1748989 Move `fkeep!` docstring to the right function (#503)
1aa6431 Update ci.yml timeout (#507)
1f88ae1 Update ci.yml  - add codecov token (#504)
```

Co-authored-by: Dilum Aluthge <[email protected]>
(cherry picked from commit ddd7afb)
tecosaur pushed a commit to tecosaur/julia that referenced this issue Mar 4, 2024
…aLang#53361)

Stdlib: SparseArrays
URL: https://github.com/JuliaSparse/SparseArrays.jl.git
Stdlib branch: main
Julia branch: master
Old commit: c9f7293
New commit: cb602d7
Julia version: 1.12.0-DEV
SparseArrays version: 1.11.0(Does not match)
Bump invoked by: @dkarrasch
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
JuliaSparse/SparseArrays.jl@c9f7293...cb602d7

```
$ git log --oneline c9f7293..cb602d7
cb602d7 Add generic matmatmul for inplace sparse x sparse (JuliaLang#486)
95575c0 Speedup for `findmin()/findmax()` on sparse arrays (JuliaLang#510) (JuliaLang#511)
4cc31f2 Fix error message in getcommon() in cholmod (JuliaLang#509)
1748989 Move `fkeep!` docstring to the right function (JuliaLang#503)
1aa6431 Update ci.yml timeout (JuliaLang#507)
1f88ae1 Update ci.yml  - add codecov token (JuliaLang#504)
```

Co-authored-by: Dilum Aluthge <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

6 participants