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

Made a fix that worked for me to stop Stackoverflow exception. Replac… #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fredborden214
Copy link

…ed recursion with

iterating over a stack

@z3nth10n
Copy link

z3nth10n commented May 22, 2023

I checked your PR. And there are still StackOverflowException on other methods...

System.StackOverflowException: The requested operation caused a stack overflow.
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_gc_wbarrier_generic_nostore_internal(intptr)
  at (wrapper write-barrier) System.Object.wbarrier_conc(intptr)
  at System.Collections.Generic.List`1+Enumerator[T]..ctor (System.Collections.Generic.List`1[T] list) [0x00000] in <9aad1b3a47484d63ba2b3985692d80e9>:0 
  at System.Collections.Generic.List`1[T].GetEnumerator () [0x00000] in <9aad1b3a47484d63ba2b3985692d80e9>:0 
  at Parabox.CSG.Node.Invert () [0x0000f] in A:\VIZZUTA\Unity\Tests\dummy-csg-tests\Repos\pb_CSG\CSG\Classes\Node.cs:56 
  at Parabox.CSG.Node.Invert () [0x00059] in A:\VIZZUTA\Unity\Tests\dummy-csg-tests\Repos\pb_CSG\CSG\Classes\Node.cs:60 
  at Parabox.CSG.Node.Invert () [0x00059] in A:\VIZZUTA\Unity\Tests\dummy-csg-tests\Repos\pb_CSG\CSG\Classes\Node.cs:60 
  at Parabox.CSG.Node.Invert () [0x00059] in A:\VIZZUTA\Unity\Tests\dummy-csg-tests\Repos\pb_CSG\CSG\Classes\Node.cs:60 
......

I'm testing this on a production-ready project with complex and random polygons generated and I don't manage to fix them. Please, review it, if you want I can share my project with a faulting polygon.

I modified a little bit the code, so the lines don't match with the original one:

image

Supposedly the problem is at the front?.Invert() line (line 60) as the front variable is also another Node class. The error is triggered at the loop from above (line 56).

@fredborden214
Copy link
Author

Havent touched any unity development since I made this PR but would be happy to take another look.

If you can provide a project or directions to recreate the issue I could try to provide some input

@z3nth10n
Copy link

I tried to fix all of the Stackoverflow exceptions by using Stacks, but it'll take me a while to resolve it. I'm limiting the while iteration to 10000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants