StackOverflowException tip
Posted: Mon Jan 27, 2014 4:10 am
Neither .NET nor Mono are very helpful if you get a StackOverflowException. Cobra's own -detailed-stack-trace option can help here. It explicitly guards against stack overflow with a lower threshold and gives you the recent stack frames when it happens.
Tonight I had a program that overflowed and all .NET told me about it was that it happened. Then I added this to the top of the code (the shorthand name of the option):
And got this:
... which is all I needed to quickly fix the problem.
Tonight I had a program that overflowed and all .NET told me about it was that it happened. Then I added this to the top of the code (the shorthand name of the option):
@args -dst
And got this:
- Code: Select all
Cobra detected stack overflow:
Last 20 frames:
480. def RegExRoute.match at line 62
481. def RegExRoute.error at line 59
482. def RegExRoute.match at line 62
483. def RegExRoute.error at line 59
484. def RegExRoute.match at line 62
485. def RegExRoute.error at line 59
486. def RegExRoute.match at line 62
487. def RegExRoute.error at line 59
488. def RegExRoute.match at line 62
489. def RegExRoute.error at line 59
490. def RegExRoute.match at line 62
491. def RegExRoute.error at line 59
492. def RegExRoute.match at line 62
493. def RegExRoute.error at line 59
494. def RegExRoute.match at line 62
495. def RegExRoute.error at line 59
496. def RegExRoute.match at line 62
497. def RegExRoute.error at line 59
498. def RegExRoute.match at line 62
499. def RegExRoute.error at line 58
500. def RegExRoute.regEx.get at line 53
Fail fast: Stack Overflow
... which is all I needed to quickly fix the problem.