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

long tuple problems #11320

Closed
yuyichao opened this issue May 18, 2015 · 6 comments
Closed

long tuple problems #11320

yuyichao opened this issue May 18, 2015 · 6 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior regression Regression in behavior compared to a previous version
Milestone

Comments

@yuyichao
Copy link
Contributor

Minimum working example

Enumerate((Int, 1:10000...))

Segfault in GC and is possibly an GC issue so the full backtrace is not that interesting...

Trace before gc fires

#97 jl_gc_collect (full=full@entry=0) at gc.c:2227
#98 0x00007ffff6afb25f in maybe_collect () at gc.c:777
#99 alloc_big (sz=sz@entry=40080) at gc.c:851
#100 0x00007ffff6afb98e in allocobj (sz=sz@entry=40072) at gc.c:2449
#101 0x00007ffff6add409 in newobj (nfields=5009, type=0x7ffdf2398010) at julia_internal.h:28
#102 jl_new_uninitialized_datatype (nfields=9998) at alloc.c:520
#103 0x00007ffff6a7e981 in inst_datatype (dt=0x7ffdf239c370, p=0x153d7d0, iparams=<optimized out>, ntp=9998, cacheable=<optimized out>, isabstract=0, n=0, env=0x0, 
    stack=0x0) at jltypes.c:1968
#104 0x00007ffff6a9334a in jl_apply (nargs=<optimized out>, args=0x1529f20, f=0x7ffdf23ace50) at julia.h:1290
#105 jl_f_apply (F=<optimized out>, args=<optimized out>, nargs=<optimized out>) at builtins.c:472

This is arguably not a good thing to do but is actually what is done in showerror(::IO, ::MethodError) for a long argument list.

Edit: This is not a stack overflow because that would be #11321 and it is much slower and would raise a StackOverflowError instead of a SegFault.

Mailing list link: https://groups.google.com/forum/#!topic/julia-dev/BLvIjoiJtaI
@ScottPJones
@carnaval

@ScottPJones
Copy link
Contributor

Thanks for opening an issue on this!

@yuyichao
Copy link
Contributor Author

Just to clarify. The branch I had to reproduce this already has the fix for #11313. A version before it is fixed seems to hit that SegFault first and end up with a slightly different backtrace pattern.

@yuyichao
Copy link
Contributor Author

OK. The issue is that for a tuple longer than 8192 * 8, the offset field of jl_fielddesc_t overflow and since the first field of the I have here is a pointer field (DataType) the value of the 8192'th field get's filled into the first one which is later interpreted as a invalid pointer.

At the least an overflow check for offset would be helpful. A real solution will probably be related to #11321.

Should also be related to #10380 (which is the reason such a huge data structure is created.) @JeffBezanson

Might also be related to #11187 @Keno (although this one is not limited to codegen....)

@yuyichao
Copy link
Contributor Author

I'm glad this one seems to be GC free LOL.....
Although it triggers in the GC since it is probably the first one who tries to read the field....

Nonetheless, thanks @carnaval, your debugging techniques works =).

yuyichao added a commit to yuyichao/julia that referenced this issue May 18, 2015
@JeffBezanson JeffBezanson changed the title SegFault when creating parametrized type with super long tuple argument long tuple problems May 27, 2015
@JeffBezanson JeffBezanson added the bug Indicates an unexpected problem or unintended behavior label May 27, 2015
@JeffBezanson JeffBezanson added this to the 0.4.0 milestone May 27, 2015
@JeffBezanson JeffBezanson self-assigned this May 27, 2015
@JeffBezanson JeffBezanson added the regression Regression in behavior compared to a previous version label Jun 2, 2015
mbauman pushed a commit to mbauman/julia that referenced this issue Jun 6, 2015
tkelman pushed a commit to tkelman/julia that referenced this issue Jun 6, 2015
@Keno Keno modified the milestones: 0.4.x, 0.4.0 Jul 10, 2015
@andrewcooke
Copy link
Contributor

i'm not sure where to report the issue discussed here. my original problem is complex to reproduce, but executing

julia> vcat([(symbol(i), [symbol(i/7.0), string(i)]) for i in 1:10000]...)
ERROR: OverflowError()
 in anonymous at no file

triggers the same error in trunk (commit cf6b3c3). also, running a smaller version (1000) works and the larger as above then works. (not sure that's clear - the above is reliably giving an error only if it's the first command run after julia starts).

@JeffBezanson
Copy link
Sponsor Member

Fixed by #13147

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 regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

5 participants