Skip to content

Stack Overflow Error: Process Exited with STATUS_STACK_OVERFLOW (0xc00000fd) #40

@gitctrlx

Description

@gitctrlx

Description:

The program encounters a stack overflow error after running a series of episodes, causing it to crash with the following message:

thread 'main' has overflowed its stack
error: process didn't exit successfully: `target\debug\rl-examples.exe` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)

image

This issue typically indicates that the program is consuming more stack memory than is allocated, which could be due to excessive recursion, large stack-allocated variables, or improper thread stack size settings.


Steps to Reproduce:

  1. Navigate to the project directory:
    cd burn-rl-examples
  2. Compile and run the program:
    cargo run
  3. Observe the program processing a series of episodes. For example:
    {"episode": 0, "reward": 44.0000, "duration": 44}
    {"episode": 1, "reward": 82.0000, "duration": 82}
    ...
    {"episode": 52, "reward": 87.0000, "duration": 87}
  4. The program crashes after episode 52 with the following error:
    thread 'main' has overflowed its stack
    error: process didn't exit successfully: `target\debug\rl-examples.exe` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)
    

Expected Behavior:

The program should handle memory allocation and recursion (if any) efficiently and execute without crashing due to stack overflow.


Observed Behavior:

The program crashes after a specific number of episodes due to stack overflow.


Suggested Fixes:

  1. Optimize recursive logic or convert to iterative implementations.
  2. Allocate large variables on the heap using Box or Vec instead of the stack.
  3. Explicitly increase the thread stack size using std::thread::Builder for custom threads.
  4. Check for and fix any unintended infinite recursion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions