Error when Registering Unknown Device with Group ID

simoa year ago

Hi

I hope you're well. I'm reaching out to address an issue I've encountered with Traccar.

During the initial setup, when adding unknown devices with group ID 1, everything works fine. However, after deleting devices directly from the database and restarting Traccar, it crashes with a StackOverflowError

Here's a snippet of the error encountered upon restart:

2024-05-21 13:48:57  INFO: [Te0dbb7de] disconnected
2024-05-21 13:48:57  INFO: [Te0dbb7de] error - 
java.lang.StackOverflowError
    at org.traccar.session.cache.CacheNode.getLinks(CacheNode.java:31)
    at org.traccar.session.cache.CacheGraph.getObjectStream(CacheGraph.java:72)
    at org.traccar.session.cache.CacheGraph.lambda$getObjectStream$2(CacheGraph.java:77)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1715)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
    at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)

configuration includes:

INSERT INTO tc_groups (id, name, groupid, attributes) 
VALUES (1, 'med', 1, NULL);

INSERT INTO tc_user_group (userid, groupid) 
VALUES (1, 1);

Furthermore, there exists an admin user with id = 1 in database.

<entry key='database.ignoreUnknown'>false</entry>
<entry key='database.registerUnknown'>true</entry>
<entry key='database.registerUnknown.defaultGroupId'>1</entry>

I'd like to emphasize that the initial insertion of devices into the database happens without any issues. However, subsequent deletions followed by a Traccar restart lead to the StackOverflowError.

I disabled saving positions in the Traccar database because I'm using the Traccar API.

Could you please provide guidance on resolving this issue?

Thank you for your attention and assistance.

Best regards,

Anton Tananaeva year ago

You created a loop with groups and that's why you get this error. Why would you want to insert broken data into the database manually?

simoa year ago

Because I don't have the web interface, I just installed the Traccar server

Anton Tananaeva year ago

You still have the API, which validates errors in the data like this.