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

Cycles not detected for field recursion on arrays/lists of elements #18

Open
willtoth opened this issue Feb 4, 2023 · 0 comments
Open

Comments

@willtoth
Copy link

willtoth commented Feb 4, 2023

When implementing Loggable on a class, if that class also has a list of references to loggables in a cycle, such as static references to itself, the recursion does not terminate until a stack overflow causes a crash. Example output from crash:

Error at java.base/jdk.internal.misc.Unsafe.allocateUninitializedArray(Unsafe.java:1375): Unhandled exception: java.lang.StackOverflowError
        at java.base/jdk.internal.misc.Unsafe.allocateUninitializedArray(Unsafe.java:1375)
        at java.base/java.lang.StringConcatHelper.newArray(StringConcatHelper.java:494)
        at java.base/java.lang.StringConcatHelper.newArrayWithSuffix(StringConcatHelper.java:475)
        at edu.wpi.first.util.ErrorMessages.requireNonNullParam(ErrorMessages.java:27)
        at edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout.<init>(ShuffleboardLayout.java:24)
        at edu.wpi.first.wpilibj.shuffleboard.ContainerHelper.getLayout(ContainerHelper.java:45)
        at edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout.getLayout(ShuffleboardLayout.java:34)
        at edu.wpi.first.wpilibj.shuffleboard.ShuffleboardContainer.getLayout(ShuffleboardContainer.java:49)
        at io.github.oblarg.oblog.WrappedShuffleboardLayout.getLayout(WrappedShuffleboardLayout.java:21)
        at io.github.oblarg.oblog.Logger.logLoggable(Logger.java:1342)
        at io.github.oblarg.oblog.Logger.lambda$logLoggable$68(Logger.java:1396)
        at io.github.oblarg.oblog.Logger.logLoggable(Logger.java:1461)
        at io.github.oblarg.oblog.Logger.lambda$logLoggable$68(Logger.java:1396)
        at io.github.oblarg.oblog.Logger.logLoggable(Logger.java:1461)
        at io.github.oblarg.oblog.Logger.lambda$logLoggable$68(Logger.java:1396)
        at io.github.oblarg.oblog.Logger.logLoggable(Logger.java:1461)
        at io.github.oblarg.oblog.Logger.lambda$logLoggable$68(Logger.java:1396)
        at io.github.oblarg.oblog.Logger.logLoggable(Logger.java:1461)
        at io.github.oblarg.oblog.Logger.lambda$logLoggable$68(Logger.java:1396)
...truncated...

For example

public class MyClass implements Loggable {

  private List<MyClass> references;
  private static List <MyClass> staticReferences
}

This is the specific class that fails once brought to 2023 and add Loggable

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

No branches or pull requests

1 participant