Crystal: Make `--verbose` show macro run executions

Created on 6 Jun 2016  路  8Comments  路  Source: crystal-lang/crystal

$ crystal --version
Crystal 0.17.4 (2016-05-26)

git clone git://github.com/mperham/sidekiq.cr.git
cd sidekiq.cr
crystal deps
crystal run web.cr

Main code in question is in src/sidekiq/web.cr.

$ crystal run web.cr
Invalid memory access (signal 11) at address 0x7fff4ffa8e18
[4551332528] __crystal_sigfault_handler +64
[140735369643306] _sigtramp +26
[4575099277] GC_clear_stack_inner +49
[4575099302] GC_clear_stack_inner +74 (4 times)
[4575087723] GC_generic_malloc_many +938
[4575115617] GC_malloc +143
[4554981731] *Array(Crystal::Parser::Piece)@Array(T)#<<<Array(Crystal::Parser::Piece), Crystal::Parser::Piece>:Array(Crystal::Parser::Piece) +83
[4554980811] *Crystal::Parser#consume_delimiter<Crystal::Parser, Array(Crystal::Parser::Piece), Crystal::Token::DelimiterState, Bool>:{Crystal::Token::DelimiterState, Bool, Regex::Options, Crystal::Location?} +779
[4554970284] *Crystal::Parser#parse_delimiter<Crystal::Parser>:Crystal::ASTNode+ +508
[4554762678] *Crystal::Parser#parse_atomic_with_method<Crystal::Parser>:Crystal::ASTNode+ +230
[4554758855] *Crystal::Parser#parse_prefix<Crystal::Parser>:Crystal::ASTNode+ +471
[4554757922] *Crystal::Parser#parse_mul_or_div<Crystal::Parser>:Crystal::ASTNode+ +114
[4554756802] *Crystal::Parser#parse_add_or_sub<Crystal::Parser>:Crystal::ASTNode+ +114
[4554756226] *Crystal::Parser#parse_shift<Crystal::Parser>:Crystal::ASTNode+ +114
[4554755682] *Crystal::Parser#parse_logical_and<Crystal::Parser>:Crystal::ASTNode+ +114
[4554755106] *Crystal::Parser#parse_logical_or<Crystal::Parser>:Crystal::ASTNode+ +114
feature compiler

Most helpful comment

However, I think it would be nice to see what the compiler is doing. We can probably make --verbose output a line on every run so it's easy to see the infinite recursion happening.

All 8 comments

Looks like a stack overflow in the compiler, it only comes to halt in the parser while expanding a macro.

Can you paste some code into the issue? Other it will become impossible to reproduce

@asterite the current master of sidekiq.cr does reproduce it and I wouldn't know where to even start reducing either.

Ah. Then the revision is needed, if a workaround is introduced and we don't fix it now. 1f790f9

Not a bug, you are calling ecr "_nav" in your layout, and ecr renders layout.ecr, so it renders infinitely, hence the stack overflow.

However, I think it would be nice to see what the compiler is doing. We can probably make --verbose output a line on every run so it's easy to see the infinite recursion happening.

Close this issue then or change it to track that enhancement?

Track as enhancement :-)

Was this page helpful?
0 / 5 - 0 ratings