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

Can't run skeleton template on a roborio 1 #126

Open
Emma03L opened this issue Dec 6, 2024 · 3 comments
Open

Can't run skeleton template on a roborio 1 #126

Emma03L opened this issue Dec 6, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Emma03L
Copy link

Emma03L commented Dec 6, 2024

Describe the bug
When trying to run the basic skeleton template on a roborio 1 you get an error saying there is insufficient memory

To Reproduce
Open the skeleton template from v4.0.0-beta-1 release.
Build the project and deploy to a roborio 1.

Expected behavior
The skeleton template should not cause memory problems.

Screenshots
image

Version (required):

  • OS: Windows 11
  • Wpilib: 2025.1.1-beta-2
  • Java version: 17
  • vendor deps versions the same as the skeleton project
@Emma03L Emma03L added the bug Something isn't working label Dec 6, 2024
@jwbonner
Copy link
Member

jwbonner commented Dec 7, 2024

We're experimenting with some different GC options for the AdvantageKit templates this year, with the goal of improving performance on the RIO 1 and 2. After some further testing, there area some specific optimizations that we will probably disable by default because they can cause these types of issues on the RIO 1 (despite improving performance on the RIO 2).

Try updating build.gradle to include only the following settings under frcJava(getArtifactTypeClass('FRCJavaArtifact')):

frcJava(getArtifactTypeClass('FRCJavaArtifact')) {
    jvmArgs.add("-XX:GCTimeRatio=5")
    jvmArgs.add("-XX:+UseSerialGC")
    jvmArgs.add("-XX:MaxGCPauseMillis=50")
}

This is closer to WPILib's default settings, and seems to work well on the RIO 1 in my testing. We will probably switch the default GC in the templates to this configuration, with documentation for additional options RIO 2 users may want to enable.

@21-CameronM
Copy link

21-CameronM commented Dec 8, 2024

I've been experiencing the same issue on our RIO 1. With the specified changes to the build.gradle (which appear to have already been in the build.gradle when I downloaded the skeleton template), it is still crashing. When SSH'ing into the rio, I'm able to see there's between 30-45MB free, but the program is attempted to allocate ~70MB.

# /tmp/hs_err_pid6134.log
# An error report file with more information is saved as:  
# Native memory allocation (mmap) failed to map 69992448 bytes for committing reserved memory.  
# There is insufficient memory for the Java Runtime Environment to continue. 

@jwbonner
Copy link
Member

jwbonner commented Dec 8, 2024

The updates I posted are not in the posted skeleton template. The lines I posted should be the only configuration under frcJava.

tbowers7 added a commit to AZ-First/Az-RBSI that referenced this issue Dec 10, 2024
Crash on RIO 1 because of AK25's aggressive garbage collection, which
works well on the RIO 2.  This commit implements the changes suggested
in this issue on GitHub:

Mechanical-Advantage/AdvantageKit#126

	modified:   build.gradle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants